Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Add your Python code here. E.g.
- from microbit import *
- import radio
- #Pin 0 is the left motor
- #Pin 1 is the rigth motor
- #Pin 3 is a buzzer
- Starten = false
- while Starten == false:
- if button_a.is_pressed():
- Starten = true
- else:
- microbit.display.scroll('Druk op A')
- radio.on()
- radio.config(channel=56)
- radio.config(power=7)
- while Starten == true:
- Commando = radio.receive()
- if Commando == "vooruit":
- pin0.write_digital(1)
- pin1.write_digital(1)
- if Commando == "remmen":
- pin0.write_digital(0)
- pin1.write_digital(0)
- if Commando == "links":
- pin0.write_digital(0)
- pin1.write_digital(1)
- if Commando == "rechts":
- pin0.write_digital(1)
- pin1.write_digital(0)
- if Commando == "toeter":
- pin3.write_digital(1)
- sleep(2000)
- pin3.write_digital(0)
- if button_b.is_pressed():
- Starten = false:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement