Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <M5Stack.h>
  2.  
  3. #define PIN_SW 2
  4.  
  5.  
  6. void setup() {
  7. M5.begin();
  8. M5.Lcd.fillScreen(BLACK);
  9.  
  10. pinMode(PIN_SW, INPUT_PULLUP);
  11. }
  12.  
  13. void loop() {
  14. M5.update();
  15.  
  16. M5.Lcd.setCursor(10, 30);
  17. M5.Lcd.setTextSize(10);
  18. if(digitalRead(PIN_SW) == LOW) {
  19. M5.Lcd.println("ON ");
  20. } else {
  21. M5.Lcd.println("OFF ");
  22. }
  23. delay(500);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement