#define LED_D4 12
#define LED_D5 13
#define BUTTON_BOOT 9
volatile bool ledState =false;
void timerISR()
{
ledState = !ledState;
digitalWrite(LED_D4, ledState);
}
hw_timer_t* timer = NULL;
// the setup function runs once when you press reset or power the board
void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_D4, OUTPUT);
pinMode(LED_D5, OUTPUT);
digitalWrite(LED_D4, 0);
digitalWrite(LED_D5, 0);
// pinMode(BUTTON_BOOT, INPUT);
timer = timerBegin(0, 80, true);
timerAttachInterrupt(timer, &timerISR, true);
timerAlarmWrite(timer, 1000000, true);
timerAlarmEnable(timer);
}
// the loop function runs over and over again forever
void loop()
{
// digitalWrite(LED_D4, HIGH); // turn the LED on (HIGH is the voltage level)
// delay(1000); // wait for a second
// digitalWrite(LED_D4, LOW); // turn the LED off by making the voltage LOW
// delay(1000); // wait for a second
// if(digitalRead(BUTTON_BOOT)==0)
// {
// digitalWrite(LED_D5, 0);
// }
// else
// {
// digitalWrite(LED_D5, 1);
// }
}
|