]> git.piffa.net Git - sketchbook_andrea/commitdiff
Serial rgb
authorAndrea Manni <andrea@piffa.net>
Mon, 28 Dec 2015 16:06:28 +0000 (17:06 +0100)
committerAndrea Manni <andrea@piffa.net>
Mon, 28 Dec 2015 16:06:28 +0000 (17:06 +0100)
RGB_LED/rgb_3_ReadASCIIString/rgb_3_ReadASCIIString.ino
serial/analog_rx_1/analog_rx_1.ino
serial/analog_tx_1/analog_tx_1.ino
serial/serial_2_rx/serial_2_rx.ino

index d1c2a3b13cf7d20a90bb76649997cd5ba55b2d3a..13cf2b850df49ff712ccfb5b2ddf2686478b0b0a 100644 (file)
@@ -7,17 +7,15 @@
  It looks for an ASCII string of comma-separated values.
  It parses them into ints, and uses those to fade an RGB LED.
  
  It looks for an ASCII string of comma-separated values.
  It parses them into ints, and uses those to fade an RGB LED.
  
- Circuit: Common-anode RGB LED wired like so:
- * Red cathode: digital pin 3
- * Green cathode: digital pin 5
- * blue cathode: digital pin 6
- * anode: +5V
+
  
  Once you have programmed the Arduino, open your Serial minitor. 
  Make sure you have chosen to send a newline character when sending a message. 
  Enter values between 0-255 for the lights in the following format : 
  Red,Green,Blue. 
 
  
  Once you have programmed the Arduino, open your Serial minitor. 
  Make sure you have chosen to send a newline character when sending a message. 
  Enter values between 0-255 for the lights in the following format : 
  Red,Green,Blue. 
 
+ Seriously: did you set the Newline setting in the monitor?
+
  
  Once you have sent the values to the Arduino, 
  the attached LED will turn the color you specified, 
  
  Once you have sent the values to the Arduino, 
  the attached LED will turn the color you specified, 
index b1c3f0d21a8c435fe65e12febfab67fc052b715f..b0f4c33dd356a8e764c3d888531e1c36717906ec 100644 (file)
@@ -32,3 +32,9 @@ void loop() {
   }
 }
 
   }
 }
 
+
+/* Domande:
+ 1. Perche' i due ground delle due schede sono collegati?
+ 2. Quanti LED posso pilotare con questo sistema?
+ 3. Con che  latenze lavoro?
+ */
index 1f148fb4f8a3841fb1b641184a93a5144be6e766..5f7a5d9d42db782d97b9e335a6c24afaacc346bd 100644 (file)
@@ -27,15 +27,20 @@ void loop() {
   if (digitalRead(input) == LOW) { // Verifica se il PIN input e' +5v
     digitalWrite(led, HIGH); // Debug
     digitalWrite(TX, HIGH);
   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
   } 
   else { // Alterativa: se non e' +5v
-    digitalWrite(led, LOW);
+    digitalWrite(led, LOW); // Debug
     digitalWrite(TX, LOW);
     delay(50);
   }
 }
 
 
     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?
+ */
 
 
 
 
index 4f9feec484d9829a412a3f91c8290ee253806dce..bd3e039707ae3031f4e81fc1917404f41eddb3ca 100644 (file)
@@ -25,11 +25,11 @@ void setup() {
 
 // the loop routine runs over and over again forever:
 void loop() {
 
 // the loop routine runs over and over again forever:
 void loop() {
-  if (Serial.read() == 1) { // Verifica se il PIN input e' +5v
+  if (Serial.read() == 1) { // Verifica i dati ricevuti
     digitalWrite(led, HIGH);
     delay(50);
   } 
     digitalWrite(led, HIGH);
     delay(50);
   } 
-  else if (Serial.read() == 0) { // Alterativa: se non e' +5v
+  else if (Serial.read() == 0) { // Alterativa
     digitalWrite(led, LOW);
     delay(50);
   }
     digitalWrite(led, LOW);
     delay(50);
   }