In this example for the PreonVM the 4 LEDs on the Preon32 Shuttle are controlled with different frequencies. As period duration a time of 1000ms is used. Depending on the colour, the LEDs are switched on and off with 0.25, 0.50, 0.75 or 1.00 of the period duration. The example shows how different time behaviour can be implemented in parallel. Due to the internal hardware-based counters in the microcontroller, the set times in the range of milliseconds are reached very precisely. In addition to the 4 threads for controlling the LEDs, the main program is in sleep mode, which it briefly leaves every 1000ms.

Copy to Clipboard