Shop OBEX P1 Docs P2 Docs Learn Events
Make 2 thing in the same time ? — Parallax Forums

Make 2 thing in the same time ?

PodionPodion Posts: 90
edited 2011-07-17 23:44 in BASIC Stamp
Hello,

I have a BS2 and I what to know if it's possible to make a LED flashing at the same time that a servo is running ?

My project is to make my boe-bot running forward and make a LED flash in continuos at te same time. I what the LED never stop flashing even if the bot is running or stop. Is that possible to run tow different command at the same time?

Comments

  • ajwardajward Posts: 1,130
    edited 2011-07-16 06:17
    The BS2 can only process one command at a time. If all you need is a flashing LED, consider a blinking LED such as this: http://www.radioshack.com/product/index.jsp?productId=2062553 HTH!

    @
  • PodionPodion Posts: 90
    edited 2011-07-16 08:40
    Is there any other basic stamp who can execute 2 or more command at the same time ?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-07-16 09:58
    You can do what you want with the BS2. In the 20 ms between pulses to the servo, you can use a counter to count down to the next LED output transition. When the count reaches zero, toggle the LED pin and reinitialize the counter.

    -Phil
  • PodionPodion Posts: 90
    edited 2011-07-17 15:53
    You can do what you want with the BS2. In the 20 ms between pulses to the servo, you can use a counter to count down to the next LED output transition. When the count reaches zero, toggle the LED pin and reinitialize the counter.

    -Phil

    Do you have an example for that ? I'm not sure haw to do this. Do I have to make another counter in the servo commande line ?
  • ercoerco Posts: 20,256
    edited 2011-07-17 18:14
    a:for count=1 to 100' for/next loop sets flash frequency
    pulsout 1,850 'servo 1
    pulsout 2,850 'servo 2
    pause 20
    next
    toggle 3' LED on pin 3
    goto a
  • PodionPodion Posts: 90
    edited 2011-07-17 23:44
    ok thank you very mush all
Sign In or Register to comment.