Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

63 lines (47 sloc) 1.33 KB
/************************************************************************
M5StackFire I2C Scanner
The M5StackFire has a connector for I2C devices.
This program scans the addresses 1-127 continuosly and shows
the devices found on the TFT.
The M5Stack fire has two internal I2C devices at address 0x68 and 0x75.
If they do not appear on the TFT it could mean you made a short cut on
the I2C bus.
October 2018, ChrisMicro
************************************************************************/
#include <M5Stack.h>
void setup()
{
M5.Lcd.begin();
M5.Lcd.fillScreen( BLACK );
M5.Lcd.setCursor(0, 0);
M5.Lcd.setTextColor(YELLOW);
M5.Lcd.setTextSize(2);
M5.Lcd.fillScreen( BLACK );
M5.Lcd.setCursor(0, 0);
M5.Lcd.println("M5StackFire I2C Tester");
Wire.begin();
delay(3000);
M5.Lcd.fillScreen( BLACK );
}
int textColor=YELLOW;
void loop()
{
int address;
int error;
M5.Lcd.setCursor(0, 0);
M5.Lcd.println("scanning Address [HEX]");
for(address = 1; address < 127; address++ )
{
Wire.beginTransmission(address);
error = Wire.endTransmission();
if(error==0)
{
M5.Lcd.print(address,HEX);M5.Lcd.print(" ");
}
else M5.Lcd.print(".");
delay(10);
}
if(textColor==YELLOW) textColor=GREEN;
else textColor=YELLOW;
M5.Lcd.setTextColor(textColor,BLACK);
}
You can’t perform that action at this time.