program test { #include #include #include #include var TimeForRun = 0 var FirstRun = 0 var Direction2 = 0 var Hit = 0 var Lengt = 0 var Skip = 0 var Lenght50 = 0 var Lengt25 = 0 var Lenght125 = 0 sensor touch3 on 3 touch3 is switch as boolean event tPress_touch3EventPress when touch3.pressed event equal_HitEventEqual when Hit = 10 macro INIT_TIME_TEST { power [ A ] 4 Skip = 0 FirstRun = 10 direction [ B ] [ ] on [ B ] wait until equal_HitEventEqual off [ B ] sound 1 Hit = 0 FirstRun = 0 direction [ ] [ B ] clear Timer1 on [ B ] Skip = 10 wait 50 Skip = 0 wait until equal_HitEventEqual off [ B ] Hit = 0 display TimeForRun:1 } macro INIT_LENGHTVARS { Lengt = TimeForRun Lenght50 = Lengt rcx_Divide(Lenght50,20) Lengt25 = Lengt rcx_Divide(Lengt25,40) Lenght125 = Lengt rcx_Divide(Lenght125,80) } macro FIRST_L { direction [ A B C ] [ ] on [ B ] for (Lengt25*10) on [ A ] for (Lenght125*10) on [ B ] for (Lenght50*10) on [ C ] for (Lengt25*10) direction [ ] [ A ] on [ A ] for (Lenght125*10) on [ C ] for (Lenght125*10) on [ C ] for (Lengt25*10) } macro SECOND_E { direction [ A ] [ B C ] on [ A ] for (Lenght125*10) on [ C ] for (Lengt25*10) on [ B ] for (Lenght50*10) direction [ B C ] [ A ] on [ C ] for (Lengt25*10) on [ A ] for (Lenght125*10) on [ B ] for (Lengt25*10) direction [ A ] [ C ] on [ A ] for (Lengt25*10) on [ C ] for (Lengt25*10) direction [ C ] [ A B ] on [ A ] for (Lenght125*10) on [ C ] for (Lenght125*10) on [ C ] for (Lengt25*10) on [ B ] wait until equal_HitEventEqual Hit = 0 } macro THIRD_G { direction [ A B C ] [ ] on [ B C ] for (Lengt25*10) on [ A ] for (Lenght125*10) direction [ ] [ C ] on [ C ] for (Lengt25*10) on [ B ] for (Lenght50*10) direction [ C ] [ B ] on [ C ] for (Lengt25*10) on [ B ] for (Lengt25*10) direction [ ] [ A C ] on [ C ] for (Lenght125*10) on [ A ] for (Lenght125*10) direction [ C ] [ ] on [ B C ] for (Lengt25*10) on [ B ] wait until equal_HitEventEqual Hit = 0 } macro FOURTH_O { direction [ A B C ] [ ] on [ B ] for (Lengt25*10) on [ A ] for (Lenght125*10) on [ B ] for (Lenght50*10) on [ C ] for (Lengt25*10) direction [ ] [ A B C ] on [ B ] for (Lenght50*10) on [ C ] for (Lengt25*10) on [ A ] for (Lenght125*10) direction [ C ] [ ] on [ C ] for (Lenght50*10) on [ C ] for (Lenght50*10) } main { ext InterfaceType "kFreestyle" rcx_ClearTimers bbs_GlobalReset([A B C]) trigger equal_HitEventEqual start TouchWatcher0 rcx_Priority( 8) trigger tPress_touch3EventPress try { INIT_TIME_TEST } retry on fail try { INIT_LENGHTVARS } retry on fail try { FIRST_L } retry on fail try { SECOND_E } retry on fail try { THIRD_G } retry on fail try { FOURTH_O } retry on fail try { stop tasks } retry on fail } watcher TouchWatcher0 monitor tPress_touch3EventPress { rcx_Priority( 3 ) try { if Skip = 10{ } else { if FirstRun = 0{ TimeForRun = Timer1 FirstRun = 10 } else { } if Direction2 = 0{ Direction2 = 10 } else { Direction2 = 0 } Hit = 10 } } restart on fail } restart on event }