]> git.piffa.net Git - sketchbook_andrea/blobdiff - serial/analog_tx_1/analog_tx_1.ino
Motori
[sketchbook_andrea] / serial / analog_tx_1 / analog_tx_1.ino
index 9cb5498c2a16778ff119cec8d88a3271d0e448bf..5f7a5d9d42db782d97b9e335a6c24afaacc346bd 100644 (file)
@@ -19,23 +19,28 @@ void setup() {
   // initialize the digital pin as an output.
   pinMode(led, OUTPUT);       // Il PIN e' attivato come output per DEBUG
   pinMode(TX, OUTPUT);       // Il PIN e' attivato come output
-  pinMode(input, INPUT);        // Il PIN e' attivato come output
+  pinMode(input, INPUT_PULLUP);        // Il PIN e' attivato come output
 }
 
 // the loop routine runs over and over again forever:
 void loop() {
-  if (digitalRead(input) == HIGH) { // Verifica se il PIN input e' +5v
+  if (digitalRead(input) == LOW) { // Verifica se il PIN input e' +5v
     digitalWrite(led, HIGH); // Debug
     digitalWrite(TX, HIGH);
-    delay(50);
+    delay(50); // Debounce
   } 
   else { // Alterativa: se non e' +5v
-    digitalWrite(led, LOW);
+    digitalWrite(led, LOW); // Debug
     digitalWrite(TX, LOW);
     delay(50);
   }
 }
 
 
+/* Domande:
+ 1. Perche' i due ground delle due schede sono collegati?
+ 2. Quanti LED posso pilotare con questo sistema?
+ 3. Con che  latenze lavoro?
+ */