Servo controller help please
Sticky
Posts: 42
I'm just starting with the propeller chip and I wonder if I can get some help. I'm trying to use the older model of the servo controller and I can't get it to work. I've included a picture of the breadboard setup and servo controller and servo. The controller and servo work with a BOE so I know they are good. I'm using the servo controller object and the basic stamp object. I'm sure it's a simple thing that I've missed. Thanks for the help.
Code, (I couldn't upload it.)
var
byte j,k
con
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
led = 0
photo_cell = 15
tx_pin = 30
rx_pin = 31
COMPIN = 15 'Pin used for communication with the PSC
PSC_BAUD = 0 'Baud rate (0 - 2400, 1 - 38400)
obj
bs2 : "bs2_functions_1_3_5.spin"
PSC : "ServoControllerSerial"
pub main
'it's not working??? wth
bs2.start (rx_pin,tx_pin)
PSC.START(COMPIN, PSC_BAUD)
bs2.pause (1000)
J := 4
REPEAT UNTIL J == 0
ledon
PSC.SETPOS (1,9,500)
bs2.pause (1000)
PSC.SETPOS (1,9,1000)
bs2.pause (1000)
PSC.SETPOS (1,9,750)
ledoff
BS2.PAUSE(2000)
J --
J := 5
REPEAT UNTIL J == 0
ledon
BS2.PAUSE (250)
ledoff
BS2.PAUSE (250)
J --
PUB LedOn
dira[noparse][[/noparse]led] := 1
outa[noparse][[/noparse]led] := 1
PUB LedOff
dira[noparse][[/noparse]led] := 1
outa[noparse][[/noparse]led] := 0
Code, (I couldn't upload it.)
var
byte j,k
con
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
led = 0
photo_cell = 15
tx_pin = 30
rx_pin = 31
COMPIN = 15 'Pin used for communication with the PSC
PSC_BAUD = 0 'Baud rate (0 - 2400, 1 - 38400)
obj
bs2 : "bs2_functions_1_3_5.spin"
PSC : "ServoControllerSerial"
pub main
'it's not working??? wth
bs2.start (rx_pin,tx_pin)
PSC.START(COMPIN, PSC_BAUD)
bs2.pause (1000)
J := 4
REPEAT UNTIL J == 0
ledon
PSC.SETPOS (1,9,500)
bs2.pause (1000)
PSC.SETPOS (1,9,1000)
bs2.pause (1000)
PSC.SETPOS (1,9,750)
ledoff
BS2.PAUSE(2000)
J --
J := 5
REPEAT UNTIL J == 0
ledon
BS2.PAUSE (250)
ledoff
BS2.PAUSE (250)
J --
PUB LedOn
dira[noparse][[/noparse]led] := 1
outa[noparse][[/noparse]led] := 1
PUB LedOff
dira[noparse][[/noparse]led] := 1
outa[noparse][[/noparse]led] := 0
Comments
I'm not that familiar with the BS2 code, so I didn't look at that.
I did look at your picture. I may be mistaken, but it looks like you only have two wires going to the servo, the ground and control lines. If this is the case, then the servo has no power to drive the motor.
I may be way off but I thought I'd mention it.
Good hunting!
Jim
to analyse what is going on we need your COMPLETE code as attached ZIP-archive.
You can upload code if you follow the screenshots of the attached picture
indention is critical from your post there is no indention to see.
So you really have to upload your COMPLETE project
best regards
Stefan
connected, but that does not supply power to the controller itself. Hope that's clear.
Jim
And now I know how to get code to the forum thanks Stefan.
[noparse][[/noparse]code ]
your code
[noparse][[/noparse]/code ]
like this: