初始化提交
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#include <M5StickCPlus.h>
|
||||
|
||||
void setup()
|
||||
{
|
||||
M5.Lcd.begin();
|
||||
M5.Lcd.setRotation(3);
|
||||
M5.Lcd.fillScreen( BLACK );
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.setTextColor(YELLOW);
|
||||
M5.Lcd.setTextSize(1);
|
||||
|
||||
M5.Lcd.fillScreen( BLACK );
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.println("M5StickC I2C Tester");
|
||||
|
||||
//For HY2.0-4P
|
||||
Wire.begin();
|
||||
//For HAT
|
||||
Wire1.begin(0,26);
|
||||
|
||||
delay(3000);
|
||||
M5.Lcd.fillScreen( BLACK );
|
||||
}
|
||||
|
||||
int textColor=YELLOW;
|
||||
|
||||
void loop()
|
||||
{
|
||||
int address;
|
||||
int error;
|
||||
int error1;
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.println("scanning Address [HEX]");
|
||||
|
||||
for(address = 1; address < 127; address++ )
|
||||
{
|
||||
Wire.beginTransmission(address);
|
||||
Wire1.beginTransmission(address);
|
||||
error = Wire.endTransmission();
|
||||
error1 = Wire1.endTransmission();
|
||||
if((error==0)||(error1==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);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <M5StickCPlus.h>
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
|
||||
// Display QRCode
|
||||
M5.Lcd.qrcode("http://www.m5stack.com", 0, 0, 135);
|
||||
// M5.Lcd.qrcode(const char *string, uint16_t x = 50, uint16_t y = 10, uint8_t width = 220, uint8_t version = 6);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
Reference in New Issue
Block a user