@@ -52,10 +52,10 @@ def __init__(self):
52
52
53
53
.. code-block:: python
54
54
55
- from adafruit_circuitplayground.express import circuit
55
+ from adafruit_circuitplayground.express import cpx
56
56
57
- circuit .pixels[0] = 0x000300
58
- circuit .pixels[9] = 0x030000
57
+ cpx .pixels[0] = 0x000300
58
+ cpx .pixels[9] = 0x030000
59
59
60
60
# Wait forever. CTRL-C to quit.
61
61
while True:
@@ -82,10 +82,10 @@ def button_a(self):
82
82
83
83
.. code-block:: python
84
84
85
- from adafruit_circuitplayground.express import circuit
85
+ from adafruit_circuitplayground.express import cpx
86
86
87
87
while True:
88
- if circuit .button_a:
88
+ if cpx .button_a:
89
89
print("Button A pressed!")
90
90
"""
91
91
return self ._a .value
@@ -99,10 +99,10 @@ def button_b(self):
99
99
100
100
.. code-block:: python
101
101
102
- from adafruit_circuitplayground.express import circuit
102
+ from adafruit_circuitplayground.express import cpx
103
103
104
104
while True:
105
- if circuit .button_b:
105
+ if cpx .button_b:
106
106
print("Button B pressed!")
107
107
"""
108
108
return self ._b .value
@@ -118,11 +118,11 @@ def switch(self):
118
118
119
119
.. code-block:: python
120
120
121
- from adafruit_circuitplayground.express import circuit
121
+ from adafruit_circuitplayground.express import cpx
122
122
import time
123
123
124
124
while True:
125
- print("Slide switch:", circuit .switch)
125
+ print("Slide switch:", cpx .switch)
126
126
time.sleep(1)
127
127
"""
128
128
return self ._switch .value
@@ -138,11 +138,11 @@ def temperature(self):
138
138
139
139
.. code-block:: python
140
140
141
- from adafruit_circuitplayground.express import circuit
141
+ from adafruit_circuitplayground.express import cpx
142
142
import time
143
143
144
144
while True:
145
- temperature_c = circuit .temperature
145
+ temperature_c = cpx .temperature
146
146
temperature_f = temperature_c * 1.8 + 32
147
147
print("Temperature celsius:", temperature_c)
148
148
print("Temperature farenheit:", temperature_f)
@@ -161,11 +161,11 @@ def light(self):
161
161
162
162
.. code-block:: python
163
163
164
- from adafruit_circuitplayground.express import circuit
164
+ from adafruit_circuitplayground.express import cpx
165
165
import time
166
166
167
167
while True:
168
- print("Lux:", circuit .light)
168
+ print("Lux:", cpx .light)
169
169
time.sleep(1)
170
170
"""
171
171
return self ._light .value
@@ -179,13 +179,13 @@ def red_led(self):
179
179
180
180
.. code-block:: python
181
181
182
- from adafruit_circuitplayground.express import circuit
182
+ from adafruit_circuitplayground.express import cpx
183
183
import time
184
184
185
185
while True:
186
- circuit .red_led = True
186
+ cpx .red_led = True
187
187
time.sleep(1)
188
- circuit .red_led = False
188
+ cpx .red_led = False
189
189
time.sleep(1)
190
190
"""
191
191
return self ._led .value
@@ -219,9 +219,9 @@ def play_tone(self, frequency, duration):
219
219
220
220
.. code-block:: python
221
221
222
- from adafruit_circuitplayground.express import circuit
222
+ from adafruit_circuitplayground.express import cpx
223
223
224
- circuit .play_tone(440, 1)
224
+ cpx .play_tone(440, 1)
225
225
"""
226
226
# Play a tone of the specified frequency (hz).
227
227
self .start_tone (frequency )
@@ -238,15 +238,15 @@ def start_tone(self, frequency):
238
238
239
239
.. code-block:: python
240
240
241
- from adafruit_circuitplayground.express import circuit
241
+ from adafruit_circuitplayground.express import cpx
242
242
243
243
while True:
244
- if circuit .button_a:
245
- circuit .start_tone(262)
246
- elif circuit .button_b:
247
- circuit .start_tone(294)
244
+ if cpx .button_a:
245
+ cpx .start_tone(262)
246
+ elif cpx .button_b:
247
+ cpx .start_tone(294)
248
248
else:
249
- circuit .stop_tone()
249
+ cpx .stop_tone()
250
250
"""
251
251
self ._speaker_enable .value = True
252
252
self ._generate_sample ()
@@ -262,28 +262,28 @@ def stop_tone(self):
262
262
263
263
.. code-block:: python
264
264
265
- from adafruit_circuitplayground.express import circuit
265
+ from adafruit_circuitplayground.express import cpx
266
266
267
267
while True:
268
- if circuit .button_a:
269
- circuit .start_tone(262)
270
- elif circuit .button_b:
271
- circuit .start_tone(294)
268
+ if cpx .button_a:
269
+ cpx .start_tone(262)
270
+ elif cpx .button_b:
271
+ cpx .start_tone(294)
272
272
else:
273
- circuit .stop_tone()
273
+ cpx .stop_tone()
274
274
"""
275
275
# Stop playing any tones.
276
276
if self .sample is not None and self .sample .playing :
277
277
self .sample .stop ()
278
278
self ._speaker_enable .value = False
279
279
280
280
281
- circuit = Express ()
281
+ cpx = Express ()
282
282
"""Object that is automatically created on import.
283
283
284
284
To use, simply import it from the module:
285
285
286
286
.. code-block:: python
287
287
288
- from adafruit_circuitplayground.express import circuit
288
+ from adafruit_circuitplayground.express import cpx
289
289
"""
0 commit comments