Guest User

PLAYER MVP

a guest
Jan 12th, 2019
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #PLAYER
  2. from microbit import *
  3. import radio
  4.  
  5. radio.on()
  6. radio.config(channel=30)
  7. # display.off()
  8.  
  9. POSITION_1 = '1'
  10. POSITION_2 = '2'
  11. POSITION_3 = '3'
  12. POSITION_4 = '4'
  13.  
  14. #change pins based on wiring
  15. def send_position():
  16. if pin0.read_digital():
  17. radio.send(POSITION_1)
  18. display.show("1")
  19. sleep(500)
  20. if pin1.read_digital():
  21. radio.send(POSITION_2)
  22. display.show("2")
  23. sleep(500)
  24. if pin2.read_digital():
  25. radio.send(POSITION_3)
  26. display.show("3")
  27. sleep(500)
  28. display.clear()
  29. """
  30. if pin3.read_digital():
  31. radio.send(POSITION_4)
  32. """
  33.  
  34.  
  35. while True:
  36. send_position()
Advertisement
Add Comment
Please, Sign In to add comment