top of page

Servo Claw Test

This simple program uses two servos to control a simple claw where the servo on pin a1 move the claw uyp and down and the servo on a2 opens and closes the claw.
A set of 5 RGB smart LEDs is connected to pin a3 and randomly change color.

Program


---

Servo Arm Test Program

---

prog_vars =

d/count 0

d/arm_pos 0

d/claw_pos 0

d/total_leds 5

d/led_no 0

d/red 0

d/green 0

d/blue 0

prog_vars.


prog_start =

"Robot Arm Program"

svp a1 0

svp a2 20

sled a3 /total_leds 0 /red /green /blue

prog_start.


prog_loop =

change_led_colors

repeat 1 ->

svt a1 0 90 10

svt a2 0 100 10

d50

repeat.

change_led_colors

repeat 1 ->

svt a1 1 90 10

svt a2 0 100 10

d50

repeat.

change_led_colors

prog_loop.




change_led_colors =


repeat 25 ->

-- Set each color to a random value

rand 0 255 -> /red

rand 0 255 -> /green

rand 0 255 -> /blue

sled a3 /total_leds /led_no /red /green /blue

dly 25

-- Inc to the next LED and then start again.

any /led_no >= 6 ->

/led_no 0

else

inc /led_no

enda.

repeat.


change_led_colors.


prog_stop =

"Bye"

prog_stop.



bottom of page