Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool button1Int=0;
- int button1Time=0;
- ISR(INT0_vect) {
- EIMSK &= ~(1<<INT0); //disable this interrupt
- button1Int=1;
- }
- void button1Click() {
- Serial.print("test ");
- }
- void loop() {
- if (button1Int) {
- if(button1Time==0)
- button1Time = millis();
- if ((millis() - button1Time) > 20) {
- button1Time = 0;
- button1Int = 0;
- button1Click();
- EIFR |= 1<<INTF0; //clear iterrupt flag
- EIMSK |= 1 << INT0; //re-enable interrupt
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment