Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. # Add your Python code here. E.g.
  2. from microbit import *
  3. import radio
  4.  
  5. #Pin 0 is the left motor
  6. #Pin 1 is the rigth motor
  7. #Pin 3 is a buzzer
  8.  
  9. Starten = false
  10.  
  11. while Starten == false:
  12. if button_a.is_pressed():
  13. Starten = true
  14. else:
  15. microbit.display.scroll('Druk op A')
  16.  
  17. radio.on()
  18. radio.config(channel=56)
  19. radio.config(power=7)
  20.  
  21. while Starten == true:
  22. Commando = radio.receive()
  23.  
  24. if Commando == "vooruit":
  25. pin0.write_digital(1)
  26. pin1.write_digital(1)
  27.  
  28. if Commando == "remmen":
  29. pin0.write_digital(0)
  30. pin1.write_digital(0)
  31.  
  32. if Commando == "links":
  33. pin0.write_digital(0)
  34. pin1.write_digital(1)
  35.  
  36. if Commando == "rechts":
  37. pin0.write_digital(1)
  38. pin1.write_digital(0)
  39.  
  40. if Commando == "toeter":
  41. pin3.write_digital(1)
  42. sleep(2000)
  43. pin3.write_digital(0)
  44.  
  45. if button_b.is_pressed():
  46. Starten = false:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement