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 // Prima scheda: input
14 int input = 2; // Questa e' la scheda con un input
16 // the setup routine runs once when you press reset:
18 // initialize the digital pin as an output.
19 pinMode(led, OUTPUT); // Il PIN e' attivato come output
20 pinMode(input, INPUT); // Il PIN e' attivato come output
22 Serial.begin(9600); // Attiviamo la seriale
25 // the loop routine runs over and over again forever:
27 if (digitalRead(input) == HIGH) { // Verifica se il PIN input e' +5v
28 digitalWrite(led, HIGH);
32 else { // Alterativa: se non e' +5v
33 digitalWrite(led, LOW);