Advertisement
Guest User

Untitled

a guest
Dec 12th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. volatile bool isrunning = 0;
  2.  
  3. ISR(TIM1_COMPA_vect) {
  4.   if (!isrunning++) {
  5.     sei();
  6.     if (currentStep < 100)
  7.       currentStep += 1;
  8.     else
  9.       currentStep = 0;
  10.     for (uint8_t x = 0; x <= 9; x++)
  11.       (currentStep < pwmled[x]) ? (x < 8 ? PORTA |= (1 << p[x]) : PORTB |= (1 << p[x])) : (x < 8 ? PORTA &= ~(1 << p[x]) : PORTB &= ~(1 << p[x]));
  12.     isrunning = 0;
  13.   }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement