Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean volatile clignote=1;
- boolean volatile led=1;
- void setup(){
- cli();
- TCCR1A = 0;TCCR1C = 0;TCNT1 = 0;
- TCCR1B = ( 1<<WGM12) | (1<<CS12) | (0<<CS11) | (1<<CS10) ;
- OCR1A = 3680;
- TIMSK1 = 1 << OCIE1A;
- sei();
- }
- void loop() {
- delay(5000); //la led clignote pendant 5s
- clignote=0;digitalWrite(13,0);
- delay(5000); //la led est éteinte pendant 5s
- clignote=1;
- }
- ISR(TIMER1_COMPA_vect)
- {if (clignote==1){digitalWrite(13,led);led=!led;}}
Advertisement
Add Comment
Please, Sign In to add comment