12345678910111213141516171819202122232425262728 |
- #include <M5Stack.h>
- const int motor_pin = 21;
- int freq = 10000;
- int ledChannel = 0;
- int resolution = 10;
- void setup() {
-
- M5.begin();
- M5.Power.begin();
- M5.Lcd.setCursor(120, 110, 4);
- M5.Lcd.println("MOTOR");
- ledcSetup(ledChannel, freq, resolution);
- ledcAttachPin(motor_pin, ledChannel);
- }
- void loop() {
-
- ledcWrite(ledChannel, 512);
- delay(1000);
- ledcWrite(ledChannel, 0);
- delay(1000);
- }
|