HardwareTimer: set pin output to low after pausing the timer #2863
|
I use hardware timers and on one pin I toggle a LED and at some point I want it to stop blinking and just be off. Now I simply do What would be the "official" way to do this? |
Answered by
fpistm
Dec 4, 2025
Replies: 3 comments 6 replies
|
How you toggle it? With digitalWrite in the timer callback? If yes then using digitalWrite low seems the best option |
0 replies
|
No, I toggle it using the timer functionality: |
2 replies
|
a not very elegant workaround: only possible because timing is not critical at all |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @PerennialNovice
I found the correct way to do this.
In fact you don't need to pause the timer.
Simpy change the mode to
MyTim->setMode(2, TIMER_OUTPUT_COMPARE_FORCED_INACTIVE, redLEDPin);Then to restore:
MyTim->setMode(2, TIMER_OUTPUT_COMPARE_TOGGLE, redLEDPin);