error: 'butt_flag' was not declared in this scope

ошибка при компиляции программы в среде разработки Arduino IDE.

C:\Users\717177\Desktop\ArduinoFirzt\ArduinoFirzt.ino: In function 'void loop()': ArduinoFirzt:12:20: error: 'butt_flag' was not declared in this scope if (butt == 1 && butt_flag == 0) ^~~~~~~~~ C:\Users\717177\Desktop\ArduinoFirzt\ArduinoFirzt.ino:12:20: note: suggested alternative: 'but_flag' if (butt == 1 && butt_flag == 0) ^~~~~~~~~ but_flag ArduinoFirzt:20:20: error: 'butt_flag' was not declared in this scope if (butt == 0 && butt_flag == 1) ^~~~~~~~~ C:\Users\717177\Desktop\ArduinoFirzt\ArduinoFirzt.ino:20:20: note: suggested alternative: 'but_flag' if (butt == 0 && butt_flag == 1) ^~~~~~~~~ but_flag exit status 1 'butt_flag' was not declared in this scope введите сюда описание изображения

код:

boolean but_flag = 0;
boolean butt;
void setup() 
{
pinMode(3, INPUT_PULLUP);

}
void loop() 
{
butt = !digitalRead(3);

if (butt == 1 && butt_flag == 0)
{
butt_flag = 1;
Serial.println(" Button pressed ");
}



if (butt == 0 && butt_flag == 1) 
{
butt_flag = 0;
Serial.println(" Button released ");
}




}

Извините, я наверное извращенец, но мне именно так нравится ставить скобки)


Ответы (1 шт):

Автор решения: timur

У вас объявлена переменная but_flag, а вы используете butt_flag

→ Ссылка