KRITSADA

microbit Radio Control Robot Sender

Jan 5th, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let Times = 0
  2. input.onButtonPressed(Button.A, () => {
  3.     radio.sendNumber(5)
  4. })
  5. input.onGesture(Gesture.LogoUp, () => {
  6.     radio.sendNumber(1)
  7. })
  8. input.onGesture(Gesture.ScreenUp, () => {
  9.     radio.sendNumber(5)
  10. })
  11. input.onGesture(Gesture.LogoDown, () => {
  12.     radio.sendNumber(4)
  13. })
  14. input.onGesture(Gesture.TiltLeft, () => {
  15.     radio.sendNumber(2)
  16. })
  17. input.onGesture(Gesture.TiltRight, () => {
  18.     radio.sendNumber(3)
  19. })
  20. Times = input.runningTime() + 1000
  21. radio.setGroup(56)
  22. radio.setTransmitPower(7)
  23. basic.forever(() => {
  24.     if (input.runningTime() > Times) {
  25.         Times = input.runningTime() + 1000
  26.         led.toggle(0, 0)
  27.     }
  28. })
Advertisement
Add Comment
Please, Sign In to add comment