File tree Expand file tree Collapse file tree
I2C_Scanners/arduino/i2c_scanner Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // SPDX-FileCopyrightText: 2023 Carter Nelson for Adafruit Industries
2+ //
3+ // SPDX-License-Identifier: MIT
14// --------------------------------------
25// i2c_scanner
36//
@@ -26,7 +29,7 @@ void loop() {
2629 Serial.println (" Scanning..." );
2730
2831 nDevices = 0 ;
29- for (address = 1 ; address < 127 ; address++ )
32+ for (address = 1 ; address < 127 ; address++ )
3033 {
3134 // The i2c_scanner uses the return value of
3235 // the Write.endTransmisstion to see if
@@ -37,20 +40,20 @@ void loop() {
3740 if (error == 0 )
3841 {
3942 Serial.print (" I2C device found at address 0x" );
40- if (address<16 )
43+ if (address<16 )
4144 Serial.print (" 0" );
4245 Serial.print (address,HEX);
4346 Serial.println (" !" );
4447
4548 nDevices++;
4649 }
47- else if (error==4 )
50+ else if (error==4 )
4851 {
4952 Serial.print (" Unknown error at address 0x" );
50- if (address<16 )
53+ if (address<16 )
5154 Serial.print (" 0" );
5255 Serial.println (address,HEX);
53- }
56+ }
5457 }
5558 if (nDevices == 0 )
5659 Serial.println (" No I2C devices found\n " );
You can’t perform that action at this time.
0 commit comments