control leds with picaxe software

Discussion in 'Embedded Systems and Microcontrollers' started by nyyankeehater, Oct 21, 2008.

  1. nyyankeehater

    Thread Starter New Member

    Oct 21, 2008
    1
    0
    im trying to flash 4 leds with multiple flash patterns but i need to know the command(s) to flash all 4 of them at the same time. everything i try flashes them in sequence. please help!
     
  2. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    One way to do it would be to set up four counters, and an "LED image" variable.
    Load the counters with different numbers.
    Run a loop like this:

    Code ( (Unknown Language)):
    1. Loop:
    2.        Decrement counter1
    3.        if Counter1 == 0 then
    4.             Reload Counter1
    5.             Toggle LED1 bit in the LED image
    6.        end if
    7.        Repeat for the other counters
    8.        Send the LED image to the LED port
    9. endloop

    Using the image allows you to send out different ON and OFF commands simultaneously.

    --Rich
     
Loading...