# setup threshold for detecting claps mic.threshold = 250 # reset outputs call sound.system(-1) call leds.top(0,0,0) call leds.bottom.left(0,0,0) call leds.bottom.right(0,0,0) call leds.circle(0,0,0,0,0,0,0,0) onevent prox when prox.horizontal[1] > 2000 and prox.horizontal[2] > 2000 and prox.horizontal[3] > 2000 do call leds.top(32,0,0) motor.left.target = -500 motor.right.target = -500 end when prox.horizontal[5] > 2000 and prox.horizontal[6] > 2000 do call leds.top(32,0,0) motor.left.target = 500 motor.right.target = 500 end when prox.ground.delta[0] > 450 and prox.ground.delta[1] > 450 do call leds.top(32,0,0) motor.left.target = -500 motor.right.target = -500 end onevent buttons when button.center == 1 do motor.left.target = 0 motor.right.target = 0 end when button.right == 1 do motor.left.target = 500 motor.right.target = 0 call leds.top(0,20,0) end when button.left == 1 do motor.left.target = 0 motor.right.target = 500 call leds.top(0,32,0) end when button.backward == 1 do motor.left.target = -500 motor.right.target = -500 call leds.top(0,32,0) end when button.forward == 1 do motor.left.target = 500 motor.right.target = 500 call leds.top(0,32,0) end when button.forward == 1 and button.left == 1 do motor.left.target = 350 motor.right.target = 500 call leds.top(0,32,0) end when button.forward == 1 and button.right == 1 do motor.left.target = 500 motor.right.target = 350 call leds.top(0,32,0) end onevent mic call leds.top(0,0,32)