#define BTN_01 2
boolean BTN_STATUS = LOW, LED_STATUS;
int repetari = 0;
void setup() {
// put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT);
pinMode(BTN_01, INPUT);
//Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
LED_STATUS = digitalRead(LED_BUILTIN);
if(digitalRead(BTN_01) == HIGH)
{
BTN_STATUS = HIGH;
}
if(BTN_STATUS == HIGH)
{
if (repetari < 10)
{
if(LED_STATUS == HIGH)
{
digitalWrite(LED_BUILTIN,LOW);
}
else
{
digitalWrite(LED_BUILTIN, HIGH);
}
repetari++;
}
else
{
repetari = 0;
BTN_STATUS = LOW;
}
}
else
{
digitalWrite(LED_BUILTIN,LOW);
}
// Serial.println(repetari);
delay(500);
}