-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunc.py
67 lines (51 loc) · 1.7 KB
/
func.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from __future__ import print_function
from __future__ import division
from builtins import input
##The above lines are random crap
import time
from BrickPi import *
BrickPiSetup()
##BrickPi.MotorEnable[PORT_A] = 1
##BrickPi.MotorEnable[PORT_B] = 1
##BrickPi.MotorEnable[PORT_C] = 1
##BrickPi.MotorEnable[PORT_D] = 1
##BrickPi.SensorType[PORT_1] = TYPE_SENSOR_TOUCH
##BrickPi.SensorType[PORT_2] = TYPE_SENSOR_TOUCH
##BrickPi.SensorType[PORT_3] = TYPE_SENSOR_COLOR_RED
##BrickPi.SensorType[PORT_3] = TYPE_SENSOR_COLOR_FULL
##BrickPi.SensorType[PORT_4] = TYPE_SENSOR_ULTRASONIC_CONT
BrickPiSetupSensors()
def motor(port, speed):
BrickPi.MotorSpeed[port] = speed
BrickPiUpdateValues()
def motorall(speed):
BrickPi.MotorSpeed[PORT_A] = speed
BrickPi.MotorSpeed[PORT_B] = speed
BrickPi.MotorSpeed[PORT_C] = speed
BrickPi.MotorSpeed[PORT_D] = speed
BrickPiUpdateValues()
def motorenable():
BrickPi.MotorEnable[PORT_A] = 1
BrickPi.MotorEnable[PORT_B] = 1
BrickPi.MotorEnable[PORT_C] = 1
BrickPi.MotorEnable[PORT_D] = 1
def motordisable():
BrickPi.MotorEnable[PORT_A] = 0
BrickPi.MotorEnable[PORT_B] = 0
BrickPi.MotorEnable[PORT_C] = 0
BrickPi.MotorEnable[PORT_D] = 0
def touchenable(p1, p2):
BrickPi.SensorType[p1] = TYPE_SENSOR_TOUCH
BrickPi.SensorType[p2] = TYPE_SENSOR_TOUCH
def colorblue():
BrickPi.SensorType[PORT_3] = TYPE_SENSOR_COLOR_BLUE
BrickPiSetupSensors()
BrickPiUpdateValues()
def colorred():
BrickPi.SensorType[PORT_3] = TYPE_SENSOR_COLOR_RED
BrickPiSetupSensors()
BrickPiUpdateValues()
def colorgreen():
BrickPi.SensorType[PORT_3] = TYPE_SENSOR_COLOR_GREEN
BrickPiSetupSensors()
BrickPiUpdateValues()