top of page

Sync Command Test

This is a program to test the new sync command.

Program


---

Sync Command Test Program

This is a program to test the new sync command.

---


prog_vars =


d/var1 1

d/var2 2

d/volts 0

d/volt2 0

d/speed 0

d/light 0

d/run_no 0

d/turn_servo 0

d/sine 0.0

prog_vars.


prog_start =

print "Sync Test Prog"


-- Sync var 2 to var 1's value.

sync /var1 /var2

-- get port B1

gvr b1 -50 180

-- Setup a Sync Daisy Chain

-- Sync b1 to /volts var

sync b1 /volts

-- get port B2 . Steering

gvr b2 -100 100

sync b2 /light

sync b2 153 free.5

mapi -100 100 0 180 /light -> /turn_servo

sync turn_servo c1 free.1

-- Motor speed control

sync /volts 150

sync 150 /speed

svp c1 /speed

sync b1 c1

sync /speed 150 free.5

pwm d1 50

sync b1 d1

pwm a1 50

sync /light a1

pwm a2 50

sync /light a2

sync /light d1 free.5

pwm a3 50

sync /b1 a3

pwm a4 50

sync /b1 a4

src free.1 svp c1 50

"******* RUN PROG **********"

prog_start.


prog_loop =


-- Update var 1

/var1 /run_no

sin /run_no -> /sine

mapf -1 1 0 100 /sine -> /sine

-- "var1 /var1 syncs to var2 /var2"

-- "b1 /b1 volts /volts 150 /150"

-- "light /light turn /turn_servo"

tbar * /sine 50 10 "s /sine"

-- svp c1 /speed

-- poowm d1 /speed

inc /run_no

any /run_no > 1000 -> exitprog

prog_loop.



prog_stop =


print "bye"

prog_stop.




bottom of page