Skip to content

Instantly share code, notes, and snippets.

@Shadow6363
Created January 19, 2014 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shadow6363/8512588 to your computer and use it in GitHub Desktop.
Save Shadow6363/8512588 to your computer and use it in GitHub Desktop.
#include "application.h"
uint8_t address;
int8_t status;
void setup() {
Serial.begin(115200);
Wire.begin();
}
void loop() {
Serial.println("Scanning...");
for (address = 1; address <= 127; address++) {
Wire.beginTransmission(address);
status = Wire.endTransmission(false);
if (status == 0) {
Serial.print("I2C device found at 0x");
Serial.println(address, HEX);
} else {
Serial.println(status);
}
delay(5);
}
Serial.println("done");
delay(5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment