int Button_pin = 12;
int led_pin = 11;
bool butt_flag = 0;
bool Button = 0;
bool led_flag = 0;
void led_on() {
Button = digitalRead(Button_pin);
if (Button == LOW ) {
digitalWrite(led_pin, HIGH);
}
}
void led_off() {
bool Button = digitalRead(Button_pin);
if (Button == LOW) {
digitalWrite(led_pin, LOW);
}
}
// void led_on_off() {
// Button = !digitalRead(Button_pin);
// if (Button == 1 and butt_flag == 0) {
// butt_flag = 1;
// led_flag = !led_flag;
// digitalWrite(led_pin, led_flag);
// }
// if (Button == 0 and butt_flag == 1) {
// butt_flag = 0;
// }
// }
void setup() {
pinMode(led_pin, OUTPUT);
pinMode(Button_pin, INPUT_PULLUP);
Serial.begin(115200);
}
void loop() {
// led_on();
// led_off();
led_on_off();
}
// одна функция включает, другая выключает