Skip to content

Update bus_scan.ino sketch of Wire library #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions libraries/Wire/examples/bus_scan/bus_scan.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <Wire.h>

byte startAddress = 1; // skip reserved address from 0 to 7
byte startAddress = 1;
byte endAddress = 127;

void I2CBusScan(byte startAddress, byte endAddress)
Expand All @@ -36,20 +36,22 @@ void I2CBusScan(byte startAddress, byte endAddress)
void setup()
{
// Initialize pin 13 as an output - onboard LED.
pinMode(13, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);

// join i2c bus (address optional for master)
Wire.begin();

// initialize Serial communication
Serial.begin(115200);
// wait for the Serial port to connect. Open the Serial Monitor to continue executing the sketch
while(!Serial);
}

boolean toggle = false; // state of the LED
void loop()
{
toggle = !toggle;
digitalWrite(13, toggle);
digitalWrite(LED_BUILTIN, toggle);
delay(5000);

Serial.print("Start I2C Bus Scan from ");
Expand All @@ -58,7 +60,7 @@ void loop()
Serial.print(endAddress);
Serial.println(".....");

I2CBusScan( startAddress, endAddress);
I2CBusScan(startAddress, endAddress);

Serial.println("\ndone");
}