MSP430 Fading and other long running activities using TwoMsTimer instead of delay()
This video shows a simple test TI Launchpad test bed with an RGB LED tied to three PWM pins and the red LED that comes standard. The color fading and red LED flashing are independently controlled with the code described below. Source Code Some folks just can't wait to open the source. Here is the TwoMsTimer source along with the demo program used in this blog. Overview Micro-controller projects often include a mix of parallel tasks. Handling those tasks with the right priority or interleaving can be a challenge when some of the tasks happen over long periods of time. Long is relative to the execution speed of the CPU in this case. The simplest way to handle long running activities in a micro-controller is through the use of a loop that contains some type of delay to limit the loop's speed. One of the main problems with this type of code is that the main loop() or central routines are blocked from doing anything else while in the delay block. The...