First attempt at programming and started with what I thought to be a fairly simple program but can't get it to work. Basically stripped the servorobotarm.pdf down to one servo and programmed into an 08M but all it does is runs hard to one end of the servo travel. Copy of program below.
`Boat Tacho servo driver using 08M
`Servo follows 0 to 5 volt input
`Travel Limit will be added 75-225
symbol pos1 = b1 `servo position
` *** read analogue input voltage ***
main:
readadc 1,pos1
` ***Test if value between 0-225 ***
` If not then correct to exactly 75 or 225 ***
test1:
if pos1<75 then pos1low
if pos1>225 then pos1high
pulses:
` *** optional display values on serial LCD ***
` serout 2, n2400,(254,128,"0=",pos1," ")
` *** Set servo pulses ***
servo 2,pos1
pause 1000
goto main
pos1low:
let pos1=75
goto test1
pos1high:
let pos1=225
goto pulses
Connected servo signal to pin 5 and V-divider pot across supply and centre wire to pin 6.
Drove servo with seperate supply.
`Boat Tacho servo driver using 08M
`Servo follows 0 to 5 volt input
`Travel Limit will be added 75-225
symbol pos1 = b1 `servo position
` *** read analogue input voltage ***
main:
readadc 1,pos1
` ***Test if value between 0-225 ***
` If not then correct to exactly 75 or 225 ***
test1:
if pos1<75 then pos1low
if pos1>225 then pos1high
pulses:
` *** optional display values on serial LCD ***
` serout 2, n2400,(254,128,"0=",pos1," ")
` *** Set servo pulses ***
servo 2,pos1
pause 1000
goto main
pos1low:
let pos1=75
goto test1
pos1high:
let pos1=225
goto pulses
Connected servo signal to pin 5 and V-divider pot across supply and centre wire to pin 6.
Drove servo with seperate supply.
Attachments
-
38.9 KB Views: 12
Last edited: