Is there a simple way of flashing a LED whilst carrying on with another task. A simple loop of turn LED on, delay, turn LED off, delay, will of course flash it, but can't then move on to perform other code.
Can I use a timer or something like that to flash the LED? Could use a very slow PWM but I don't have PWM on my version of Flowcode.
I want to do this to blink my LEDs briefly to save battery power.
Flashing/blinking LED
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Here is a simple program.
Main Program
Start
Calculation - counter = 0
Interrupt - Enable timer interrupts
While 1 - Main Program Loop
End
Timer_Interrupt_Macro
Start
Decision - Counter = 255
YES: Decision - PIN on - YES - Turn Off Pin / NO - Turn On Pin
NO: Calculation - Counter = Counter + 1
End
Main Program
Start
Calculation - counter = 0
Interrupt - Enable timer interrupts
While 1 - Main Program Loop
End
Timer_Interrupt_Macro
Start
Decision - Counter = 255
YES: Decision - PIN on - YES - Turn Off Pin / NO - Turn On Pin
NO: Calculation - Counter = Counter + 1
End
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel