Загрузка данных


#define BUTTON 2
#define LED 9

int count = 0;
int oldButton = HIGH;

void setup()
{
  pinMode(BUTTON, INPUT_PULLUP);
  pinMode(LED, OUTPUT);
}

void loop()
{
  int button = digitalRead(BUTTON);

  if (button == LOW && oldButton == HIGH)
  {
    delay(50);

    count++;

    if (count == 3)
    {
      for (int i = 0; i <= 255; i++)
      {
        analogWrite(LED, i);
        delay(12);
      }
    }

    if (count == 4)
    {
      analogWrite(LED, 0);
      count = 0;
    }
  }

  oldButton = button;
}