4 Comunicazione analogica tra due schede arduino.
5 La prima scheda ha un bottone come input e
6 comunica con un altra scheda che monta un LED come output.
7 Il led della seconda si accende quando rileva
8 la pressione del bottone della prima.
11 // Seconda scheda: output
12 int led = 13; // Questa scheda ha spolo l'output
13 int RX = 3 ; // Pin di ricezione
16 // initialize the digital pin as an output.
17 pinMode(led, OUTPUT); // Il PIN e' attivato come output
18 pinMode(RX, INPUT); // Il PIN e' attivato come output
21 // the loop routine runs over and over again forever:
23 if (digitalRead(RX) == 1) { // Verifica se il PIN input e' +5v
24 digitalWrite(led, HIGH);
27 else if (digitalRead(RX) == 0) { // Alterativa: se non e' +5v
28 digitalWrite(led, LOW);