From: Andrea Manni Date: Mon, 28 Dec 2015 16:06:28 +0000 (+0100) Subject: Serial rgb X-Git-Url: http://git.piffa.net/web?a=commitdiff_plain;h=a94e5e6347ed7bdf43aa20bf400255325a033278;p=sketchbook_andrea Serial rgb --- diff --git a/RGB_LED/rgb_3_ReadASCIIString/rgb_3_ReadASCIIString.ino b/RGB_LED/rgb_3_ReadASCIIString/rgb_3_ReadASCIIString.ino index d1c2a3b..13cf2b8 100644 --- a/RGB_LED/rgb_3_ReadASCIIString/rgb_3_ReadASCIIString.ino +++ b/RGB_LED/rgb_3_ReadASCIIString/rgb_3_ReadASCIIString.ino @@ -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. - 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. + 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, diff --git a/serial/analog_rx_1/analog_rx_1.ino b/serial/analog_rx_1/analog_rx_1.ino index b1c3f0d..b0f4c33 100644 --- a/serial/analog_rx_1/analog_rx_1.ino +++ b/serial/analog_rx_1/analog_rx_1.ino @@ -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? + */ diff --git a/serial/analog_tx_1/analog_tx_1.ino b/serial/analog_tx_1/analog_tx_1.ino index 1f148fb..5f7a5d9 100644 --- a/serial/analog_tx_1/analog_tx_1.ino +++ b/serial/analog_tx_1/analog_tx_1.ino @@ -27,15 +27,20 @@ void loop() { 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? + */ diff --git a/serial/serial_2_rx/serial_2_rx.ino b/serial/serial_2_rx/serial_2_rx.ino index 4f9feec..bd3e039 100644 --- a/serial/serial_2_rx/serial_2_rx.ino +++ b/serial/serial_2_rx/serial_2_rx.ino @@ -25,11 +25,11 @@ void setup() { // 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); } - else if (Serial.read() == 0) { // Alterativa: se non e' +5v + else if (Serial.read() == 0) { // Alterativa digitalWrite(led, LOW); delay(50); }