| Posted: 11:56am 23 Nov 2025 |
Copy link to clipboard |
 Print this post |
|
I am reading the manual... but obviously missing something
SERVO 1.bas
' Program to run a servo on a PICO 2040 ' Servo Signal = GP8 ' From the manual page 154... ' ------------------------------------------------------------------ ' As with the PWM command the pins must be set up with SETPIN n,PWM ' ------------------------------------------------------------------ SetPin GP8, PWM ' ------------------------------------------------------------------ ' From the manual: SERVO channel [positionA][,positionB] ' Looking at the RP2350 chart (There is none for the 2040) it seems ' that GP8 is Channel 4A. I have a continuous turn servo connected to ' GP8. If the range is -120 to +120, then 0 should be center or STOP ' for a continuous turn.
Print "Start"
Servo 4, 0 Pause 2000 PWM 4, OFF
Print "STOP" END
I would expect the continuous rotation servo to be at or near center... but it takes off spinning hard.
If I change the line to
SERVO 4,-100
To get a different motion, it fails... [17] Servo 4, -100 Error : Syntax >
If I attempt to use a variable...
' Program to run a servo on a PICO 2040 ' Servo Signal = GP8 ' From the manual page 154... ' ------------------------------------------------------------------ ' As with the PWM command the pins must be set up with SETPIN n,PWM ' ------------------------------------------------------------------ SetPin GP8, PWM ' ------------------------------------------------------------------ ' From the manual: SERVO channel [positionA][,positionB] ' Looking at the RP2350 chart (There is none for the 2040) it seems ' that GP8 is Channel 4A. I have a continuous turn servo connected to ' GP8. If the range is -120 to +120, then 0 should be center or STOP ' for a continuous turn.
Print "Start" For X = -120 to 120 Servo 4, x Pause 2000 Next x PWM 4, OFF
Print "STOP" END
It also fails with a SYNTAX ERROR.
I'm starting to think the SERVO command is broken.
Has anyone else had any luck with it? |