Microbit/microbit/__init__.py

changeset 11
c8198736bff3
parent 10
f34fe5abe069
equal deleted inserted replaced
10:f34fe5abe069 11:c8198736bff3
20 pass 20 pass
21 21
22 def temperature(): 22 def temperature():
23 pass 23 pass
24 24
25 ###################################################################### 25 def set_volume(volume):
26 26 pass
27 class MicroBitButton(): 27
28 ######################################################################
29
30 class Button():
28 def is_pressed(self): 31 def is_pressed(self):
29 pass 32 pass
30 33
31 def was_pressed(self): 34 def was_pressed(self):
32 pass 35 pass
33 36
34 def get_presses(self): 37 def get_presses(self):
35 pass 38 pass
36 39
37 button_a = MicroBitButton() 40 button_a = Button()
38 button_b = MicroBitButton() 41 button_b = Button()
39 42
40 ###################################################################### 43 ######################################################################
44
45 class MicroBitTouchOnlyPin():
46 RESISTIVE = 0
47 CAPACITIVE = 1
48
49 def is_touched(self):
50 pass
51
52 def set_touch_mode(self, mode):
53 pass
41 54
42 class MicroBitDigitalPin(): 55 class MicroBitDigitalPin():
43 PULL_UP = 0 56 PULL_UP = 0
44 PULL_DOWN = 1 57 PULL_DOWN = 1
45 NO_PULL = 2 58 NO_PULL = 2
92 pass 105 pass
93 106
94 def set_analog_period_microseconds(self, period): 107 def set_analog_period_microseconds(self, period):
95 pass 108 pass
96 109
110 def get_analog_period_microseconds(self):
111 pass
112
97 def set_pull(self, mode): 113 def set_pull(self, mode):
98 pass 114 pass
99 115
100 def get_pull(self): 116 def get_pull(self):
101 pass 117 pass
106 class MicroBitTouchPin(): 122 class MicroBitTouchPin():
107 PULL_UP = 0 123 PULL_UP = 0
108 PULL_DOWN = 1 124 PULL_DOWN = 1
109 NO_PULL = 2 125 NO_PULL = 2
110 126
127 RESISTIVE = 0
128 CAPACITIVE = 1
129
111 def read_digital(self): 130 def read_digital(self):
112 pass 131 pass
113 132
114 def write_digital(self, value): 133 def write_digital(self, value):
115 pass 134 pass
124 pass 143 pass
125 144
126 def set_analog_period_microseconds(self, period): 145 def set_analog_period_microseconds(self, period):
127 pass 146 pass
128 147
148 def get_analog_period_microseconds(self):
149 pass
150
151 def set_pull(self, mode):
152 pass
153
154 def get_pull(self):
155 pass
156
157 def get_mode(self):
158 pass
159
129 def is_touched(self): 160 def is_touched(self):
130 pass 161 pass
131 162
132 def set_pull(self, mode): 163 def set_touch_mode(self, mode):
133 pass
134
135 def get_pull(self):
136 pass
137
138 def get_mode(self):
139 pass 164 pass
140 165
141 pin0 = MicroBitTouchPin() # Pad 0 166 pin0 = MicroBitTouchPin() # Pad 0
142 pin1 = MicroBitTouchPin() # Pad 1 167 pin1 = MicroBitTouchPin() # Pad 1
143 pin2 = MicroBitTouchPin() # Pad 2 168 pin2 = MicroBitTouchPin() # Pad 2
155 pin14 = MicroBitDigitalPin() # SPI MISO 180 pin14 = MicroBitDigitalPin() # SPI MISO
156 pin15 = MicroBitDigitalPin() # SPI SCK 181 pin15 = MicroBitDigitalPin() # SPI SCK
157 pin16 = MicroBitDigitalPin() # 182 pin16 = MicroBitDigitalPin() #
158 pin19 = MicroBitDigitalPin() # I2C SCL 183 pin19 = MicroBitDigitalPin() # I2C SCL
159 pin20 = MicroBitDigitalPin() # I2C SDA 184 pin20 = MicroBitDigitalPin() # I2C SDA
185
186 pin_logo = MicroBitTouchOnlyPin() # V2: Touch Logo
187 pin_speaker = MicroBitDigitalPin() # V2: Speaker
160 188
161 ###################################################################### 189 ######################################################################
162 190
163 class Image(): 191 class Image():
164 HEART = Image() 192 HEART = Image()
264 def fill(self, value): 292 def fill(self, value):
265 pass 293 pass
266 294
267 def blit(self, src, x, y, width, height, xdest=0, ydest=0): 295 def blit(self, src, x, y, width, height, xdest=0, ydest=0):
268 pass 296 pass
297
298 ######################################################################
299
300 class Sound():
301 GIGGLE = Sound()
302 HAPPY = Sound()
303 HELLO = Sound()
304 MYSTERIOUS = Sound()
305 SAD = Sound()
306 SLIDE = Sound()
307 SOARING = Sound()
308 SPRING = Sound()
309 TWINKLE = Sound()
310 YAWN = Sound()
311
312 ######################################################################
313
314 class SoundEvent():
315 LOUD = SoundEvent('loud')
316 QUIET = SoundEvent('quiet')

eric ide

mercurial