Sorry, I missed this before: You have 3 cases: (i 2), (i==3). After the third interrupt, i becomes both >2 and ==3, so you turn on LED2 but then set i=0 (so it is then =2)[2nd case] or (i==4) [3rd case] so there's a visible time gap where LED2 is lit.
↧