aboutsummaryrefslogtreecommitdiff
path: root/libraries/Wire/examples/slave_receiver/slave_receiver.ino
diff options
context:
space:
mode:
authorFederico Fissore <f.fissore@arduino.cc>2015-07-06 15:18:33 +0200
committerFederico Fissore <f.fissore@arduino.cc>2015-07-06 15:19:05 +0200
commitb5a130afb51c971fd7ceca8834b6055f1eada253 (patch)
treed1e964f67822e9b3f10382573a9579c85b9c3e3f /libraries/Wire/examples/slave_receiver/slave_receiver.ino
parentc13cf02651e178ea7941a82bee364d82c6b19b9c (diff)
Examples: mass code format. See example_formatter.conf
Diffstat (limited to 'libraries/Wire/examples/slave_receiver/slave_receiver.ino')
-rw-r--r--libraries/Wire/examples/slave_receiver/slave_receiver.ino12
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
}