#define led1 A1
#define led2 A2
int d1 = 300;
int d2 = 500;
uint32_t m1 = 0, m2 = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(57600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
Serial.println("Booting");
}
void checkSerial()
{
if (Serial.available())
{
uint8_t c = Serial.read();
if (c == 'A') d1 += 10;
if (c == 'a') d1 -= 10;
}
}
void loop() {
// put your main code here, to run repeatedly:
checkSerial();
if (millis() - m1 > d1)
{
digitalWrite(led1, !digitalRead(led1));
m1 = millis();
}
if (millis() - m2 > d2)
{
digitalWrite(led2, !digitalRead(led2));
m2 = millis();
}
}