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 buttons if button.forward == 1 then new_state = 1 end if button.backward == 1 and (state & 1) == 1 then new_state = 2 end if button.forward == 1 and (state & 2) == 2 then new_state = 3 end if button.backward == 1 and (state & 3) == 3 then new_state = 4 end if button.forward == 1 and (state & 4) == 4 then new_state = 5 end if button.backward == 1 and (state & 5) == 5 then new_state = 6 end if button.forward == 1 and (state & 6) == 6 then new_state = 7 end if button.backward == 1 and (state & 7) == 7 then new_state = 0 end if button.forward == 1 then call leds.circle(32,0,0,0,0,0,0,0) end if button.backward == 1 and (state & 1) == 1 then call leds.circle(0,32,0,0,0,0,0,0) end if button.forward == 1 and (state & 2) == 2 then call leds.circle(0,0,32,0,0,0,0,0) end if button.backward == 1 and (state & 3) == 3 then call leds.circle(0,0,0,32,0,0,0,0) end if button.forward == 1 and (state & 4) == 4 then call leds.circle(0,0,0,0,32,0,0,0) end if button.backward == 1 and (state & 5) == 5 then call leds.circle(0,0,0,0,0,32,0,0) end if button.forward == 1 and (state & 6) == 6 then call leds.circle(0,0,0,0,0,0,32,0) end if button.backward == 1 and (state & 7) == 7 then call leds.circle(0,0,0,0,0,0,0,32) end state = new_state call leds.temperature(((state>>0) & 1)*10+((state>>1) & 1)*22,((state>>2) & 1)*10+((state>>3) & 1)*22)