3 Ricezine di una stringa di testo via I2C
5 This example code is in the public domain.
7 Schema: http://lab.piffa.net/schemi/i2c_bb.jpg
16 Wire.begin(4); // join i2c bus with address #4
17 Wire.onReceive(receiveEvent); // register event
20 Serial.begin(9600); // start serial for output
21 Serial.println("Slave / RX Debug:");
29 // Nel Loop non succede niente, tutta l'azione e nella funzione receiveEvent()
30 // Innescata dall'evento Wire.onReceive
33 // function that executes whenever data is received from master
34 // this function is registered as an event, see setup()
35 void receiveEvent(int howMany)
37 Serial.print("Lo slave ha ricevuto il seguente messaggio: ");
38 while( Wire.available()) // loop through all but the last
40 input = Wire.read(); // receive byte as a character
41 Serial.print(input); // print the character
42 } // print the integer