This program steps the servos shaft from 0 to 180 degrees and back to 0 in 10deg steps. The servo is connected to port A1. Print the arm angle in the print tab.
This goes with the Using RC Servos Part 2 video
Program
---
RC Servo Demo 1
THis program steps the servos shaft from 0 to
180 degrees and back to 0 in 10deg steps.
The servo is connected to port A1.
Print the arm angle in the print tab.
---
prog_vars =
d/count 0
d/arm_angle 0
prog_vars.
prog_start =
pclear
svp a1 0
print "RC Servo Demo 1: Start"
prog_start.
prog_loop =
-- main program loop
-- 0 to 180
repeat 18 ->
svp a1 /arm_angle
"Arm Angle /arm_angle"
inc /arm_angle 10
d50
repeat.
-- 180 to 0
repeat 18 ->
svp a1 /arm_angle
"Arm Angle /arm_angle"
dec /arm_angle 10
d50
repeat.
-- exit the program
exitprog
prog_loop.
prog_stop =
print "Bye"
svp a1 0
prog_stop.