Skip to content

Instantly share code, notes, and snippets.

@TakehikoShimojima
Created December 21, 2020 00:19
Show Gist options
  • Save TakehikoShimojima/aba397f02ed242c92f1cdb828fa14b0e to your computer and use it in GitHub Desktop.
Save TakehikoShimojima/aba397f02ed242c92f1cdb828fa14b0e to your computer and use it in GitHub Desktop.
/*
* TFMini-SをI2Cモードからシリアルモードにする
*/
#include <M5StickC.h>
#include <Wire.h> // Arduino standard I2C/Two-Wire Library
#include <TFMPI2C.h> // TFMini-Plus I2C Library v1.5.0
TFMPI2C tfmP; // Create a TFMini-Plus I2C object
void setup()
{
M5.begin();
pinMode(0, INPUT_PULLUP); // SDAをプルアップする
pinMode(26, INPUT_PULLUP); // SCLをプルアップする
Wire.begin(0, 26);
M5.Lcd.setTextSize(2);
M5.Lcd.setRotation(3);
M5.Lcd.setCursor(10, 10);
M5.Lcd.print("set Serial Mode..");
if (tfmP.sendCommand(SET_SERIAL_MODE, 0)) {
M5.Lcd.print("OK");
} else {
M5.Lcd.print("Failed");
}
delay(1000);
M5.Lcd.print("save settings..");
if (tfmP.sendCommand(SAVE_SETTINGS, 0)) {
M5.Lcd.print("OK");
} else {
M5.Lcd.print("Failed");
}
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment