// $Id: test_serial.exper,v 1.5 2002/04/15 08:45:57 boissieu Exp $ define float v = 0 // C1 result. // define a condition by defining an instruction bloc // 1st call to C1 => v = 1 // 2nd call to C1 => v = 2 // 3rd call to C1 => v = 1 // 4th call to C1 => v = 1 etc. bloc C1 is set v = serial("1 2 1") end bloc is1 is C1 if v != 1 then error "serial failed" end end bloc is2 is C1 if v != 2 then error "serial(\"1 2 1\") failed" end end is1 is2 is1 is1 is2 is1 is1 is2 is1 bloc C2 is set v = serial(100) end define float c = 0 bloc checkC2 is set c = c + 1 C2 if c != v then error "serial(100) failed : " c " != " v end end for 50 do checkC2 end bloc C1_on is choose serial(6) in print " target1 Red" print " target2 Red" print " target3 Red" print " target4 Red" print " target5 Red" print " target6 Red" end end bloc C1_off is choose serial(6) in print " target1 Black" print " target2 Black" print " target3 Black" print " target4 Black" print " target5 Black" print " target6 Black" end end print "Series 1" for 10 do C1_on wait(1) C1_off wait(2) end print "End Series 1" bloc action1 is print "target1 red" print "target1 black" end bloc action2 is print "target2 red" print "target2 black" end bloc action3 is print "target3 red" print "target3 black" end for 8 do choose random() in action1 action2 action3 end end print "========= test_serial passed OK" quit