boolean wechsel = true;
boolean swap = true;
int var = 0;
void setup() {
pinMode(PA5, OUTPUT);
// put your setup code here, to run once:
Serial.begin(115200);
static HardwareTimer tm = HardwareTimer(TIM1);
tm.setOverflow(2,HERTZ_FORMAT);
tm.attachInterrupt(zeit);
tm.resume();
attachInterrupt(digitalPinToInterrupt(PA1), blink, RISING);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}
void zeit(){
if(swap){
if(wechsel){
digitalWrite(PA5, HIGH);
wechsel = false;
}
else{
digitalWrite(PA5, LOW);
wechsel = true;
}
}
else{
while(var<5){
digitalWrite(PA5,HIGH);
}
var = 0;
}
}
void blink(){
swap= false;
var++;
}