const int ON_BTN_PIN = 12;
const int OFF_BTN_PIN = 11;
const int DRIVER_PIN = 3;
bool isMotorOn = false;
void setup() {
Serial.begin(115200);
pinMode(ON_BTN_PIN, INPUT_PULLUP);
pinMode(OFF_BTN_PIN, INPUT_PULLUP);
pinMode(DRIVER_PIN, OUTPUT);
}
void loop() {
if (digitalRead(ON_BTN_PIN) == LOW) isMotorOn = true;
if (digitalRead(OFF_BTN_PIN) == LOW) isMotorOn = false;
digitalWrite(DRIVER_PIN, isMotorOn);
}
ON
OFF