mirror of
				https://github.com/alexandrebobkov/ESP-Nodes.git
				synced 2025-10-31 11:55:31 +00:00 
			
		
		
		
	I2C bus scanner
What it does
This example scans the i2c bus in a loop and prints out a table with the addresses of the found i2c devices.
Wiring
Connect SCL and SDA pins to the following pins with appropriate pull-up
resistors.
| Name | Description | Defaults | 
|---|---|---|
| CONFIG_EXAMPLE_I2C_MASTER_SCL | GPIO number for SCL | "5" for esp8266, "6" foresp32c3, "19" foresp32,esp32s2, andesp32s3 | 
| CONFIG_EXAMPLE_I2C_MASTER_SDA | GPIO number for SDA | "4" for esp8266, "5" foresp32c3, "18" foresp32,esp32s2, andesp32s3 | 
Example output
Three devices found on a bus: 0x38, 0x60 and 0x77
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77