Steering Motor - Arrick Rbotics Mobile Robot User Manual

Mobile robot for hobbyist, research and education
Table of Contents

Advertisement

Drive Motor and Encoder
The previous subroutine will START the drive motor. You can monitor the progress of the drive wheel
by reading the encoder counter from the coprocessor. Here is example code that will read the encoder.
ec var word
serout net,baud,["!1E1"]
serin net,baud,[hex4, ec]
You can use this code within a loop to wait until the desired distance is completed. Put a 100 ms delay
between reads using a pause 100 command.

Steering Motor

The steering is an RC (remote control) style servo motor that is commonly used on model race cars and
airplanes. The coprocessor can control 4 RC servo motors - #1 is used for steering. When the Basic
Stamp II needs to control an RC servo motor, it simply sends a command to the coprocessor which han-
dles the task. This frees up the Basic Stamp II for other tasks.
Here is a subroutine that can be used to control all 4 RC servo motors including the steering motor #1.
Study the WANDER and TEST programs for additional insight.
'Constants and Variables.
net con 8
baud con 396
position var byte
motor var byte
'Subroutine to control RC servo motors.
'Motor # 1-4.
'Position = 1-255, 0=off, 128=center.
'The servo is moved to the desired position for 500 ms
'then turned off to conserve power.
'
rcservo:
serout net,baud,["!1R", dec1 motor, hex2 position]
serin net,baud,[charn]
pause 500
serout net,baud,["!1R", dec1 motor, "00"]
serin net,baud,[charn]
return
If you need your RC servo motor to resist movement after it has turned to the desired position, don't turn
continued
'Encoder count.
'Ask for encoder count.
'Get encoder count into ec.
'coprocessor network pin.
'coprocessor baud rate.
'Position of motor.
'Motor #.
'Get A.
'Wait for servo to turn.
'Get A.
32
'Move Motor.
'Motor off.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Arobot

Table of Contents