forked from mark-orion/STS-PiLot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
io_wrapper.py
141 lines (103 loc) · 2.23 KB
/
io_wrapper.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 15 11:56:25 2017
@author: Mark Dammer
"""
import explorerhat as xhat
explorerhat = True
# Inputs: Digital
def input_one_read():
digital = xhat.input.one.read()
return digital
def input_two_read():
digital = xhat.input.two.read()
return digital
def input_three_read():
digital = xhat.input.three.read()
return digital
def input_four_read():
digital = xhat.input.four.read()
return digital
# Inputs: Analog
def analog_one_read():
analog = xhat.analog.one.read()
return analog
def analog_two_read():
analog = xhat.analog.two.read()
return analog
def analog_three_read():
analog = xhat.analog.three.read()
return analog
def analog_four_read():
analog = xhat.analog.four.read()
return analog
# Outputs: Motors
def motor_one_speed(speed):
xhat.motor.one.speed(speed)
return
def motor_two_speed(speed):
xhat.motor.two.speed(speed)
return
# Outputs: Digital
def output_one_on():
xhat.output.one.on()
return
def output_one_off():
xhat.output.one.off()
return
def output_two_on():
xhat.output.two.on()
return
def output_two_off():
xhat.output.two.off()
return
def output_three_on():
xhat.output.three.on()
return
def output_three_off():
xhat.output.three.off()
return
def output_four_on():
xhat.output.four.on()
return
def output_four_off():
xhat.output.four.off()
return
# Outputs: LEDs
def light_blue_on():
xhat.light.blue.on()
return
def light_blue_blink(freq):
xhat.light.blue.blink(freq)
return
def light_blue_off():
xhat.light.blue.off()
return
def light_yellow_on():
xhat.light.yellow.on()
return
def light_yellow_blink(freq):
xhat.light.yellow.blink(freq)
return
def light_yellow_off():
xhat.light.yellow.off()
return
def light_red_on():
xhat.light.red.on()
return
def light_red_blink(freq):
xhat.light.red.blink(freq)
return
def light_red_off():
xhat.light.red.off()
return
def light_green_on():
xhat.light.green.on()
return
def light_green_blink(freq):
xhat.light.green.blink(freq)
return
def light_green_off():
xhat.light.green.off()
return