RELAY.ino 463 B

12345678910111213141516171819202122232425
  1. /*
  2. Description: Use RELAY to switch on and off the circuit.
  3. */
  4. #include <M5Stack.h>
  5. void setup() {
  6. M5.begin();
  7. M5.Power.begin();
  8. M5.Lcd.clear(BLACK);
  9. M5.Lcd.setTextFont(4);
  10. M5.Lcd.setTextColor(YELLOW, BLACK);
  11. M5.Lcd.setCursor(50, 0, 4);
  12. M5.Lcd.println(("Relay Example"));
  13. //disable the speak noise
  14. dacWrite(25, 0);
  15. pinMode(26, OUTPUT);
  16. }
  17. void loop(void) {
  18. digitalWrite(26, HIGH);
  19. delay(500);
  20. digitalWrite(26, LOW);
  21. delay(500);
  22. }