Shop OBEX P1 Docs P2 Docs Learn Events
LED problem: PulseBothLEDs.bs2 — Parallax Forums

LED problem: PulseBothLEDs.bs2

legoman35515legoman35515 Posts: 1
edited 2010-07-03 09:39 in Learn with BlocklyProp
the manual pg 56 says this program is supposed to blink the LEDs simotaneously... mine blink one after the other.
here is a copy of my code...

'Robotics with the Boe-Bot - PulseBothLeds.bs2
'Sends a 0.13 second pulse to the LED circuit connected to P13 and P12 every 2 s.
'{$STAMP BS2}
'{$PBASIC 2.5}

DEBUG "Program Running"
DO
·PULSOUT 13,65000
·PULSOUT 12,65000
·PAUSE 2000
LOOP

What am I doing wrong?

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-06-19 19:28
    You probably typed your code incorrectly or you are expecting something the code is not designed to do. I can't tell because you didn't attach it to your post. PULSOUT will generate a pulse for the amount of time specified and then go to the next command. You may want to use HIGH and LOW instead.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-06-20 05:47
    No you will not able to see the normal LED flashing.
    For that fast flashing there is special kind of LED is used which is superior then that. What are u using right now.
    Thats why u are not able to see the flashing.
  • hover1hover1 Posts: 1,929
    edited 2010-06-20 20:20
    You can see a normal LED flash at .13 second duration just fine. Check your facts. I have run these demonstrations myself. Have·you?

    What special LED would·you be referring to?

    Please clean up your·text and grammar. It's·almost unreadable.

    Jim
    Sandhuamarinder said...
    No you will not able to see the normal LED flashing.
    For that fast flashing there is special kind of LED is used which is superior then that. What are u using right now.
    Thats why u are not able to see the flashing.
    Post Edited (hover1) : 6/20/2010 11:44:40 PM GMT
  • hover1hover1 Posts: 1,929
    edited 2010-06-20 20:32
    I think the "simultaneously" wording in the document is a little misleading.·What you should see is·the first·LED light for .13 seconds, and than the the second LED light for .13 seconds, then a 2 second pause, and the cycle repeats.

    Because the BS2 can only do one thing at a time, it has to process the ·"PULSOUT 13,65000" first before it can move on to the next instruction, which is "PULSOUT 12,65000", hence the delay from the first LED lighting to the second. The program runs as it should. The description probably·threw you off.

    Push on with your experiments. That was a good question. Come back with any more.

    Jim

    legoman35515 said...

    the manual pg 56 says this program is supposed to blink the LEDs simotaneously... mine blink one after the other.
    here is a copy of my code...

    'Robotics with the Boe-Bot - PulseBothLeds.bs2
    'Sends a 0.13 second pulse to the LED circuit connected to P13 and P12 every 2 s.
    '{$STAMP BS2}
    '{$PBASIC 2.5}

    DEBUG "Program Running"
    DO
    ·PULSOUT 13,65000
    ·PULSOUT 12,65000
    ·PAUSE 2000
    LOOP

    What am I doing wrong?
  • Brian BBrian B Posts: 31
    edited 2010-06-21 05:21
    i did that project too and i had the same issue what i did it move the pulsout's into one line

    EXAMPLE

    DEBUG "Program Running"
    DO
    PULSOUT 13, 65000 PULSOUT 13, 65000
    LOOP
  • EverQuriousEverQurious Posts: 48
    edited 2010-07-03 09:39
    For this simple a program I would leave out the pulse commands and you should get the desired results with the code below.

    '{$STAMP BS2}
    '{$PBASIC 2.5}

    Do
    HIGH 13,
    PAUSE 2600 ' 2.6 second pause
    LOW 13
    HIGH 12
    PAUSE 2600 ' 2.6 second pause
    LOW 12
    LOOP

    This is assuming you simply have two LED wired from pins 12 and 13 to ground.
    Note that the pause is reduced to 2600 not 26000. Pause works on 1000ths of a second thus 1/0000 sec. x 2600 = 2.6 seconds.
    the lights should alternate with a w.6 second duration. Hope this helps as an alternative. EQ.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    EverQurious

    Try not to fret and worry bout the things that you have not...
    Just remember to be thankful for the things you've got !!!
Sign In or Register to comment.