-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (26 loc) · 783 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#################################
# This code was made by Vortezz #
# NOTICE : Some value has to be #
# edited before utilisation #
#################################
from microbit import *
display.off()
def command_mot1 (direction, speed):
pin8.write_digital(direction)
pin1.write_analog(speed)
def command_mot2 (direction, speed):
pin12.write_digital(direction)
pin2.write_analog(speed)
while True:
if pin7.read_digital() and pin6.read_digital():
command_mot1 (0, 0)
command_mot2 (1, 0)
elif pin6.read_digital():
command_mot1 (0, 0)
command_mot2 (1, 512)
elif pin7.read_digital():
command_mot1 (1, 512)
command_mot2 (0, 0)
else:
command_mot1 (1, 512)
command_mot2 (1, 512)