Created
May 27, 2025 21:07
-
-
Save mutkuensert/9c3fac9ce9e0cfe8f150acb444c50160 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
| void scanScreenAddress() { | |
| Wire.begin(); | |
| Serial.begin(4800); | |
| while (!Serial) | |
| ; // Needed for some cards, No problem for Nano | |
| Serial.println("Scanning I2C devices..."); | |
| byte count = 0; | |
| for (byte addr = 1; addr < 127; addr++) { | |
| Wire.beginTransmission(addr); | |
| if (Wire.endTransmission() == 0) { | |
| Serial.print("Device found: 0x"); | |
| Serial.println(addr, HEX); | |
| count++; | |
| } | |
| } | |
| if (count == 0) { | |
| Serial.println("No I2C device found."); | |
| } else { | |
| Serial.println("Scan has been finished."); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment