Flashing/blinking LED

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times

Flashing/blinking LED

Post by echase »

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.

Chet
Posts: 61
Joined: Thu Oct 13, 2005 5:05 am
Location: USA
Has thanked: 2 times

Post by Chet »

Use a timer interrupt to make a counter. blink when counter = whatever
your delay needs are. Theres a little more to it but this is a start. :wink:

User avatar
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:

Post by Benj »

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

Post Reply