Author Topic: Basic Stamp, push buttons servo positioning?  (Read 5979 times)

0 Members and 1 Guest are viewing this topic.

Offline ZriuzTopic starter

  • Beginner
  • *
  • Posts: 3
  • Helpful? 0
Basic Stamp, push buttons servo positioning?
« on: August 17, 2007, 01:01:25 AM »
   Well i'm kind of new to the seen and working on a simple little project (for you guys) that its driving me nuts.

I bought the parallax homework board for a little car project, I want to drive a pair of servos through 7 different positions, both moving at the same time but different positions. I want this to be done on steps base on inputs from two buttons, a forward and a backward. Basically the one button will move from position 1-2, and if i press the other one will go back from 2-1.   
   as i said i'm kind of new to this deal but i previously done some basic programming on a boe-bot about 2 years ago.   what i want to know is, :what kind of commands should i use to start and stop the steps ?, and what command to have the basic stamp read the program backwards as i input from the button??.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Basic Stamp, push buttons servo positioning?
« Reply #1 on: August 18, 2007, 10:38:56 AM »
I believe you can find source code to running servos and buttons by googling it . . .

Quote
I want to drive a pair of servos through 7 different positions, both moving at the same time but different positions. I want this to be done on steps base on inputs from two buttons, a forward and a backward. Basically the one button will move from position 1-2, and if i press the other one will go back from 2-1
On my robot fish I do the same thing, but Im doing 10 servos simultaneously.

So in reality, you wont actually do all at the same time, but instead cycle through them all so fast it appears to be at the same time.

For example in pseudocode:
Code: [Select]
loop:

if (button == pushed)
   x1=1200
   x2=1400
   x3=1300
   x4=1350

else if (button != pushed)
   x1=1100
   x2=1100
   x3=1100
   x4=1500

//command servos

turn on servo1
delay x1 microseconds
turn off servo1

turn on servo2
delay x2 microseconds
turn off servo2

turn on servo3
delay x3 microseconds
turn off servo3

turn on servo4
delay x4 microseconds
turn off servo4

end loop

 


Get Your Ad Here

data_list