Created
January 19, 2014 23:46
-
-
Save Shadow6363/8512588 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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