4 Comunicazione seriale 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
13 int led = 13; // Questa scheda ha spolo l'output
15 // the setup routine runs once when you press reset:
17 // initialize the digital pin as an output.
18 pinMode(led, OUTPUT); // Il PIN e' attivato come output
20 Serial.begin(9600); // Attiviamo la seriale
23 // the loop routine runs over and over again forever:
25 if (Serial.read() == 1) { // Verifica se il PIN input e' +5v
26 digitalWrite(led, HIGH);
29 else if (Serial.read() == 0) { // Alterativa: se non e' +5v
30 digitalWrite(led, LOW);