Skip to main content
deleted 30 characters in body
Source Link
BrettFolkins
  • 4.4k
  • 1
  • 14
  • 26

Unfortunately I do not have an arduino on hand to test right now, but I see a few fixes you can start with.

You should re-enable interrupts after you finish setting up. Use either

interrupts(); 

or

sei();

If you want to don't want to use the arduino specific commands.

Also, you need to enable Even if the timer 0 interrupt like thiscode does not need interrupts, background code does use them.

TIMSK0 = (1<<OCIE0A);

finally, timerTimer 0 is used in arduino for some basic "house keeping" function like keeping time. I'm not sure if that could be part of your problem. you could try using a different timer.

Unfortunately I do not have an arduino on hand to test right now, but I see a few fixes you can start with.

You should re-enable interrupts after you finish setting up. Use either

interrupts(); 

or

sei();

If you want to don't want to use the arduino specific commands.

Also, you need to enable the timer 0 interrupt like this

TIMSK0 = (1<<OCIE0A);

finally, timer 0 is used in arduino for some basic "house keeping" function like keeping time. I'm not sure if that could be part of your problem. you could try using a different timer.

You should re-enable interrupts after you finish setting up. Use either

interrupts(); 

or

sei();

If you want to don't want to use the arduino specific commands. Even if the code does not need interrupts, background code does use them.

Timer 0 is used in arduino for some basic "house keeping" function like keeping time. I'm not sure if that could be part of your problem. you could try using a different timer.

Source Link
BrettFolkins
  • 4.4k
  • 1
  • 14
  • 26

Unfortunately I do not have an arduino on hand to test right now, but I see a few fixes you can start with.

You should re-enable interrupts after you finish setting up. Use either

interrupts(); 

or

sei();

If you want to don't want to use the arduino specific commands.

Also, you need to enable the timer 0 interrupt like this

TIMSK0 = (1<<OCIE0A);

finally, timer 0 is used in arduino for some basic "house keeping" function like keeping time. I'm not sure if that could be part of your problem. you could try using a different timer.