Discussion forum for the BasicX family of microcontroller chips.
|
Hi, can anyone help me with the program to control the servo motor I am not sure what the program below is supposed to do Option Explicit Public Sub Main() Dim i as byte Do for i = 1 to 50 pulseout 10, 0.002,1 'Servo moves in one direction delay 0.02 next for i= 1 to 50 pulseout 10,0.0015,1 'Servo is not moving delay 0.02 next for i= 1 to 50 pulseout 10,0.001,1 'Servo moves in opposite direction delay 0.02 next loop End Sub If you can, pass me a simple program to control the servo that turns only 180 degrees.(HS-322HD) i can finish controlling the servo. i am using this for my project. I have very little knowledge over the programming. I used this program but I must change the pin to 5 when my input is at 10 Why?? does this program interfere with the L293. Thanks Yoga |
|
|
|
Your servo should have three wires. Connect Red to +4.8 - +6 volts Connect Black to ground Connect Yellow to pin 10 It is preferred that the servo gets it's power from a separate power source than the BX, so it doesn't "rob" the power. If you still have trouble, add "Call" and parenthesis to your statements: Call PulseOut (ServoPin, PulseWidth, 1) Call Delay (0.02) Save your L293 for any small DC motors that you may need. Thad --- yogafire27 <> wrote: > Hi, > > can anyone help me with the program to control the > servo motor > > I am not sure what the program below is supposed to > do > > Option Explicit > > Public Sub Main() > Dim i as byte > > Do > for i = 1 to 50 > pulseout 10, 0.002,1 'Servo moves in one > direction > delay 0.02 > next > > for i= 1 to 50 > pulseout 10,0.0015,1 'Servo is not moving > delay 0.02 > next > > for i= 1 to 50 > pulseout 10,0.001,1 'Servo moves in opposite > direction > delay 0.02 > next > > loop > > End Sub > > If you can, pass me a simple program to control the > servo that turns > only 180 degrees.(HS-322HD) i can finish controlling > the servo. > > i am using this for my project. > > I have very little knowledge over the programming. > > I used this program but I must change the pin to 5 > when my input is > at 10 Why?? > > does this program interfere with the L293. > > Thanks > Yoga __________________________________ |
|
|
|
How much current would a tipical servo take? Is there any code to read an RC Receiver and then throw the action to a servo?, if yes, would the power of the BX will be enough to read from 7 or 6 channels of a receiver and write to 6 or 7 servos? What does the Pulseout routin would look like in pseudocode? i don't mean the syntax, i just want to know how does it achieves a pulseout on a desired pin. Same for pulsein. Thanks Bye |