Skip to content

Commit 17b5462

Browse files
kattnitannewt
authored andcommitted
Doc updates, global brightness included.
1 parent 425afbd commit 17b5462

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

adafruit_circuitplayground/express.py

+24-9
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def acceleration(self):
7373
"""Obtain data from the x, y and z axes.
7474
7575
.. image :: /_static/accelerometer.jpg
76+
:alt: Accelerometer
7677
7778
This example prints the values. Try moving the board to see how the
7879
printed values change.
@@ -92,6 +93,7 @@ def touch_A1(self):
9293
"""Detect touch on capacitive touch pad A1.
9394
9495
.. image :: /_static/capacitive_touch_pad_A1.jpg
96+
:alt: Capacitive touch pad A1
9597
9698
.. code-block:: python
9799
@@ -110,6 +112,7 @@ def touch_A2(self):
110112
"""Detect touch on capacitive touch pad A2.
111113
112114
.. image :: /_static/capacitive_touch_pad_A2.jpg
115+
:alt: Capacitive touch pad A2
113116
114117
.. code-block:: python
115118
@@ -128,6 +131,7 @@ def touch_A3(self):
128131
"""Detect touch on capacitive touch pad A3.
129132
130133
.. image :: /_static/capacitive_touch_pad_A3.jpg
134+
:alt: Capacitive touch pad A3
131135
132136
.. code-block:: python
133137
@@ -146,6 +150,7 @@ def touch_A4(self):
146150
"""Detect touch on capacitive touch pad A4.
147151
148152
.. image :: /_static/capacitive_touch_pad_A4.jpg
153+
:alt: Capacitive touch pad A4
149154
150155
.. code-block:: python
151156
@@ -164,6 +169,7 @@ def touch_A5(self):
164169
"""Detect touch on capacitive touch pad A5.
165170
166171
.. image :: /_static/capacitive_touch_pad_A5.jpg
172+
:alt: Capacitive touch pad A5
167173
168174
.. code-block:: python
169175
@@ -182,6 +188,7 @@ def touch_A6(self):
182188
"""Detect touch on capacitive touch pad A6.
183189
184190
.. image :: /_static/capacitive_touch_pad_A6.jpg
191+
:alt: Capacitive touch pad A6
185192
186193
.. code-block:: python
187194
@@ -200,6 +207,7 @@ def touch_A7(self):
200207
"""Detect touch on capacitive touch pad A7.
201208
202209
.. image :: /_static/capacitive_touch_pad_A7.jpg
210+
:alt: Capacitive touch pad A7
203211
204212
.. code-block:: python
205213
@@ -219,20 +227,23 @@ def pixels(self):
219227
of the CircuitPlayground. Each pixel is at a certain index in the sequence
220228
as labeled below. Colors can be RGB hex like 0x110000 for red where each
221229
two digits are a color (0xRRGGBB) or a tuple like (17, 0, 0) where (R, G, B).
230+
Set the global brightness using any number from 0 to 1 to represent a
231+
percentage, i.e. 0.3 sets global brightness to 30%.
222232
223233
See `neopixel.NeoPixel` for more info.
224234
225235
.. image :: /_static/neopixel_numbering.jpg
226-
:alt: NeoPixel order diagram
236+
:alt: NeoPixel order diagram
227237
228238
Here is an example that sets the first pixel green and the second red.
229239
230240
.. code-block:: python
231241
232242
from adafruit_circuitplayground.express import cpx
233243
234-
cpx.pixels[0] = 0x000300
235-
cpx.pixels[9] = 0x030000
244+
cpx.pixels.brightness = 0.3
245+
cpx.pixels[0] = 0x003000
246+
cpx.pixels[9] = (30, 0, 0)
236247
237248
# Wait forever. CTRL-C to quit.
238249
while True:
@@ -245,7 +256,7 @@ def button_a(self):
245256
"""``True`` when Button A is pressed. ``False`` if not.
246257
247258
.. image :: /_static/button_a.jpg
248-
:alt: NeoPixel order diagram
259+
:alt: Button A
249260
250261
.. code-block:: python
251262
@@ -262,7 +273,7 @@ def button_b(self):
262273
"""``True`` when Button B is pressed. ``False`` if not.
263274
264275
.. image :: /_static/button_b.jpg
265-
:alt: NeoPixel order diagram
276+
:alt: Button B
266277
267278
.. code-block:: python
268279
@@ -281,7 +292,7 @@ def switch(self):
281292
``False`` when it is to the right towards the ear.
282293
283294
.. image :: ../_static/slide_switch.jpg
284-
:alt: NeoPixel order diagram
295+
:alt: Slide switch
285296
286297
.. code-block:: python
287298
@@ -299,7 +310,7 @@ def temperature(self):
299310
"""The temperature of the CircuitPlayground in Celsius.
300311
301312
.. image :: /_static/thermistor.jpg
302-
:alt: NeoPixel order diagram
313+
:alt: Temperature sensor
303314
304315
Converting this to Farenheit is easy!
305316
@@ -322,7 +333,7 @@ def light(self):
322333
"""The brightness of the CircuitPlayground in approximate Lux.
323334
324335
.. image :: /_static/light_sensor.jpg
325-
:alt: NeoPixel order diagram
336+
:alt: Light sensor
326337
327338
Try covering the sensor next to the eye to see it change.
328339
@@ -342,7 +353,7 @@ def red_led(self):
342353
"""The red led next to the USB plug marked D13.
343354
344355
.. image :: /_static/red_led.jpg
345-
:alt: NeoPixel order diagram
356+
:alt: D13 LED
346357
347358
.. code-block:: python
348359
@@ -383,6 +394,7 @@ def play_tone(self, frequency, duration):
383394
:param float duration: The duration of the tone in seconds
384395
385396
.. image :: /_static/speaker.jpg
397+
:alt: Onboard speaker
386398
387399
.. code-block:: python
388400
@@ -402,6 +414,7 @@ def start_tone(self, frequency):
402414
:param int frequency: The frequency of the tone in Hz
403415
404416
.. image :: /_static/speaker.jpg
417+
:alt: Onboard speaker
405418
406419
.. code-block:: python
407420
@@ -426,6 +439,7 @@ def stop_tone(self):
426439
""" Use with start_tone to stop the tone produced.
427440
428441
.. image :: /_static/speaker.jpg
442+
:alt: Onboard speaker
429443
430444
.. code-block:: python
431445
@@ -450,6 +464,7 @@ def play_file(self, file_name):
450464
:param file_name: The name of your .wav file in quotation marks including .wav
451465
452466
.. image :: /_static/speaker.jpg
467+
:alt: Onboard speaker
453468
454469
.. code-block:: python
455470

0 commit comments

Comments
 (0)