Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:40 24 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMBASIC SERVO Command issues.

Author Message
Askjerry
Newbie

Joined: 21/09/2025
Location: United States
Posts: 12
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?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10643
Posted: 12:42pm 23 Nov 2025
Copy link to clipboard 
Print this post

There is a typo in the manual. Should read
  Quote  ‘positionA’ and ‘positionB’ can be between -20 and 120 and will generate a
50Hz signal between 800uSec and 2.2mSec

So a value of 50 puts it in the middle.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025