Skip to content

Instantly share code, notes, and snippets.

@takataka5614
Created March 15, 2020 05:35
Show Gist options
  • Save takataka5614/14bb754921bd8af58bcf5ea188e1e7d1 to your computer and use it in GitHub Desktop.
Save takataka5614/14bb754921bd8af58bcf5ea188e1e7d1 to your computer and use it in GitHub Desktop.
#include <M5Stack.h>
#define LED_PIN 16 // 16番ピンにLED接続
void setup() {
M5.begin(); // Initialize the M5Stack object
pinMode(LED_PIN, OUTPUT);
}
// Add the main program code into the continuous loop() function
void loop() {
// update button state
M5.update();
if (M5.BtnA.wasReleased()) {
M5.Lcd.print('A');
digitalWrite(LED_PIN, HIGH); //Aボタン押して離したらLEDオン
}
if (M5.BtnB.wasReleased()) {
M5.Lcd.print('B');
digitalWrite(LED_PIN, LOW); //Bボタン押して離したらLEDオフ
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment