Need help with simple servo program

Hello, I have just purchased the Bot Board and BASIC 28 pin chip.
What i’m trying to program is a simple robot that has 6 servos and i what to test it out by just making it pick up an object. Nothing fancy, just trying to get the basics down. Could someone post some simple code for this (just servo one to 90 degrees and back to center or something)

Thanks :wink:

Bane

Here is a simple code you can try. I would first start out by connecting only one servo to the ABB board with it not installed in anything.

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

counter VAR Word
PINx PIN 5         'Pin 5 uesed, change this number to the pin you want to use.


DO

  FOR counter = 400 TO 728 STEP 5 '<change the step number to make servo move faster
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

  FOR counter = 728 TO 1000 STEP 5
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

  FOR counter = 1000 TO 728 STEP 5
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

  FOR counter = 728 TO 400 STEP 5
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

LOOP

hey it didn’t work. just said error

check out this page

societyofrobots.com/robotfor … icseen#new

bane

oops looks like Mike was showing Basic Stamp II code, not Basic Atom 28 code. :blush:

i haven’t had the chance to retry it, but putting a -5 should make it work?

bane

If he’ s using an Atom then a -5 is needed on the two decrementing for next loops. However if he is using an AtomPro then the Pulsout command uses .5us timings instead of 1us timings(on BS2 and Atom).

I thought he’s using a Basic stamp II on a bot board. No? That’s the forum title description anyway.

If you are using an Atom MCU, my apologies! :smiley:

I beleive he posted in the wrong forum. See his first message

I’m not aware of a 28pin BS2. Please ignore if I’m mistaken.

Please understand that i’m new to this forum and to this microcontroller. This is the one i purchased. lynxmotion.com/Product.aspx?productID=269&CategoryID=66

I tried the code, but get only a error message. I hope this is because i confused you guys on the chip, but the link ^ shows the correct one.

bane

Yes, that is the BascAtom 28 pin module. I recommend you ask you question again in the BasicAtom forum. The code above was for the BS2. You’ll need to change a couple things to compile on the Atom.

reposted in correct catagory.

sorry :open_mouth:

bane