From b5a130afb51c971fd7ceca8834b6055f1eada253 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Mon, 6 Jul 2015 15:18:33 +0200 Subject: Examples: mass code format. See example_formatter.conf --- libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino') diff --git a/libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino b/libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino index d97a9e3..4d0a68f 100644 --- a/libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino +++ b/libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino @@ -12,16 +12,14 @@ #include -void setup() -{ +void setup() { Wire.begin(); // join i2c bus (address optional for master) Serial.begin(9600); // start serial communication at 9600bps } int reading = 0; -void loop() -{ +void loop() { // step 1: instruct sensor to read echoes Wire.beginTransmission(112); // transmit to device #112 (0x70) // the address specified in the datasheet is 224 (0xE0) @@ -44,8 +42,7 @@ void loop() Wire.requestFrom(112, 2); // request 2 bytes from slave device #112 // step 5: receive reading from sensor - if (2 <= Wire.available()) // if two bytes were received - { + if (2 <= Wire.available()) { // if two bytes were received reading = Wire.read(); // receive high byte (overwrites previous reading) reading = reading << 8; // shift high byte to be high 8 bits reading |= Wire.read(); // receive low byte as lower 8 bits -- cgit v1.2.3-18-g5258