var state = 0 var new_state = 0 call sound.system(-1) call leds.temperature(0,0) call leds.top(0,0,0) call leds.circle(0,0,0,0,0,0,0,0) onevent prox if prox.horizontal[5] > 500 and prox.horizontal[6] > 500 then motor.left.target = 209 motor.right.target = 209 end if prox.horizontal[2] > 500 then motor.left.target = 0 motor.right.target = 0 end if prox.horizontal[2] > 500 and (state & 1) == 1 then motor.left.target = -70 motor.right.target = -70 end state = new_state call leds.temperature(((state>>0) & 1)*10+((state>>1) & 1)*22,((state>>2) & 1)*10+((state>>3) & 1)*22) onevent tap new_state = 1 if (state & 1) == 1 then new_state = 0 end state = new_state call leds.temperature(((state>>0) & 1)*10+((state>>1) & 1)*22,((state>>2) & 1)*10+((state>>3) & 1)*22)