diff options
Diffstat (limited to 'libraries/Wire/examples/slave_receiver')
-rw-r--r-- | libraries/Wire/examples/slave_receiver/slave_receiver.ino | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libraries/Wire/examples/slave_receiver/slave_receiver.ino b/libraries/Wire/examples/slave_receiver/slave_receiver.ino index 53df274..8051d53 100644 --- a/libraries/Wire/examples/slave_receiver/slave_receiver.ino +++ b/libraries/Wire/examples/slave_receiver/slave_receiver.ino @@ -12,24 +12,20 @@ #include <Wire.h> -void setup() -{ +void setup() { Wire.begin(8); // join i2c bus with address #8 Wire.onReceive(receiveEvent); // register event Serial.begin(9600); // start serial for output } -void loop() -{ +void loop() { delay(100); } // function that executes whenever data is received from master // this function is registered as an event, see setup() -void receiveEvent(int howMany) -{ - while (1 < Wire.available()) // loop through all but the last - { +void receiveEvent(int howMany) { + while (1 < Wire.available()) { // loop through all but the last char c = Wire.read(); // receive byte as a character Serial.print(c); // print the character } |