Skip to content

Commit 6ca02f3

Browse files
committed
Typos and remove simpleio
1 parent 32ec694 commit 6ca02f3

19 files changed

+65
-47
lines changed

Accessory_Examples/potentiometer_neopixel_strip.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@
88
Connect the black clip on the NeoPixel strip to a GND pad.
99
Connect the red clip on the NeoPixel strip to the VOUT pad.
1010
11-
THIS EXAMPLE REQUIRES A SEPARATE LIBRARY BE LOADED ONTO YOUR CIRCUITPY DRIVE.
12-
This example requires the simpleio.mpy library.
13-
1411
Rotate the potentiometer knob to watch the number of pixels lit up on the strip change!"""
1512
import time
1613
import board
17-
import simpleio
1814
import analogio
1915
import neopixel
2016

@@ -27,9 +23,15 @@ def get_voltage(pin):
2723
return (pin.value * 3.3) / 65536
2824

2925

26+
def scale_range(value):
27+
"""Scale a value from 0-320 (light range) to 0-9 (NeoPixel range, 10 total LEDs).
28+
Allows remapping light value to pixel position for light meter demo."""
29+
return round(value / 3.3 * 30)
30+
31+
3032
while True:
3133
# Potentiometer voltage value remapped to pixel position
32-
strip_peak = simpleio.map_range(get_voltage(potentiometer), 0, 3.3, 0, 30)
34+
strip_peak = scale_range(get_voltage(potentiometer))
3335

3436
for j in range(0, 30, 1):
3537
if j <= strip_peak:

Accessory_Examples/potentiometer_neopixels.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
Connect the black clip to a GND pad.
55
Connect the red clip to a 3.3v pad.
66
7-
THIS EXAMPLE REQUIRES A SEPARATE LIBRARY BE LOADED ONTO YOUR CIRCUITPY DRIVE.
8-
This example requires the simpleio.mpy library.
9-
107
Rotate the potentiometer knob to see the number of NeoPixels lit up on your CP change!"""
118
import time
129
import board
1310
import analogio
14-
import simpleio
1511
from adafruit_circuitplayground import cp
1612

1713
cp.pixels.auto_write = False
@@ -23,9 +19,15 @@ def get_voltage(pin):
2319
return (pin.value * 3.3) / 65536
2420

2521

22+
def scale_range(value):
23+
"""Scale a value from 0-320 (light range) to 0-9 (NeoPixel range, 10 total LEDs).
24+
Allows remapping light value to pixel position for light meter demo."""
25+
return round(value / 3.3 * 10)
26+
27+
2628
while True:
2729
# Potentiometer voltage value remapped to pixel position
28-
cp_peak = simpleio.map_range(get_voltage(potentiometer), 0, 3.3, 0, 10)
30+
cp_peak = scale_range(get_voltage(potentiometer))
2931

3032
for i in range(0, 10, 1):
3133
if i <= cp_peak:

Accessory_Examples/potentiometer_servo_sweep.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
Connect the red clip (on the red wire) on the servo to a 3.3v pad.
1010
1111
THIS EXAMPLE REQUIRES A SEPARATE LIBRARY BE LOADED ONTO YOUR CIRCUITPY DRIVE.
12-
This example requires the simpleio.mpy AND adafruit_motor libraries.
12+
This example requires the adafruit_motor library.
1313
1414
Rotate the potentiometer knob to watch the servo rotate!"""
1515
import board
16-
import simpleio
1716
import analogio
1817
import pwmio
1918
from adafruit_motor import servo
@@ -27,7 +26,13 @@ def get_voltage(pin):
2726
return (pin.value * 3.3) / 65536
2827

2928

29+
def scale_range(value):
30+
"""Scale a value from 0-320 (light range) to 0-9 (NeoPixel range, 10 total LEDs).
31+
Allows remapping light value to pixel position for light meter demo."""
32+
return round(value / 3.3 * 180)
33+
34+
3035
while True:
3136
# Potentiometer voltage value remapped to servo angle
32-
servo_sweep = simpleio.map_range(get_voltage(potentiometer), 0, 3.3, 0, 180)
37+
servo_sweep = scale_range(get_voltage(potentiometer))
3338
servo.angle = servo_sweep

Circuit_Playground_Bluefruit_Examples/accelerometer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This example uses the accelerometer in the center of the CP. Try moving the board around to see
1+
"""This example uses the accelerometer in the center of the CPB. Try moving the board around to see
22
the values change!"""
33
import time
44
import board

Circuit_Playground_Bluefruit_Examples/light_sensor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""This example uses the light sensor on your CP, located next to the picture of the eye. Try
2-
shining a flashlight on your CP, or covering the light sensor with your finger to see the values
1+
"""This example uses the light sensor on your CPB, located next to the picture of the eye. Try
2+
shining a flashlight on your CPB, or covering the light sensor with your finger to see the values
33
increase and decrease."""
44
import time
55
import board

Circuit_Playground_Bluefruit_Examples/temperature.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""This example uses the temperature sensor, located next to the picture of a thermometer on the
2-
CP. It prints the temperature """
2+
CPB. It prints the temperature """
33
import time
44
import board
55
import adafruit_thermistor

Circuit_Playground_Bluefruit_Examples/touch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This example uses the capacitive touch pads around the outside of the CP, labeled A1-A6 and TX.
1+
"""This example uses the capacitive touchpads around the outside of the CPB, labeled A1-A6 and TX.
22
(A0 is not a touch pad.) It prints to the serial console when you touch a pad. Try touching the
33
touch pads to see the prints!"""
44
import time

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_acceleration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This example uses the accelerometer in the center of the CP. Try moving the board around to see
1+
"""This example uses the accelerometer in the center of the CPB. Try moving the board around to see
22
the values change!"""
33
import time
44
from adafruit_circuitplayground import cp

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_acceleration_neopixels.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""If the switch is to the right, it will appear that nothing is happening. Move the switch to the
2-
left to see the NeoPixels light up in colors related to the accelerometer! The CP has an
2+
left to see the NeoPixels light up in colors related to the accelerometer! The CPB has an
33
accelerometer in the center that returns (x, y, z) acceleration values. This program uses those
44
values to light up the NeoPixels based on those acceleration values."""
55
from adafruit_circuitplayground import cp

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_light.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""This example uses the light sensor on your CP, located next to the picture of the eye. Try
2-
shining a flashlight on your CP, or covering the light sensor with your finger to see the values
1+
"""This example uses the light sensor on your CPB, located next to the picture of the eye. Try
2+
shining a flashlight on your CPB, or covering the light sensor with your finger to see the values
33
increase and decrease."""
44
import time
55
from adafruit_circuitplayground import cp

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_light_neopixels.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
"""THIS EXAMPLE REQUIRES A SEPARATE LIBRARY BE LOADED ONTO YOUR CIRCUITPY DRIVE.
2-
This example requires the simpleio.mpy library.
3-
4-
This example uses the light sensor on the CP, located net to the picture of the eye on the board.
1+
"""
2+
This example uses the light sensor on the CPB, located net to the picture of the eye on the board.
53
Once you have the library loaded, try shining a flashlight on your CP to watch the number of
6-
NeoPixels lit up increase, or try covering up the light sensor to watch the number decrease."""
4+
NeoPixels lit up increase, or try covering up the light sensor to watch the number decrease.
5+
"""
76
import time
87
from adafruit_circuitplayground import cp
9-
import simpleio
108

119
cp.pixels.auto_write = False
1210
cp.pixels.brightness = 0.3
1311

12+
13+
def scale_range(value):
14+
"""Scale a value from 0-320 (light range) to 0-9 (NeoPixel range, 10 total LEDs).
15+
Allows remapping light value to pixel position for light meter demo."""
16+
return round(value / 320 * 10)
17+
18+
1419
while True:
1520
# light value remapped to pixel position
16-
peak = simpleio.map_range(cp.light, 0, 320, 0, 10)
21+
peak = scale_range(cp.light)
1722
print(cp.light)
1823
print(int(peak))
1924

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_light_plotter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""If you're using Mu, this example will plot the light levels from the light sensor (located next
2-
to the eye) on your cp. Try shining a flashlight on your CP, or covering the light sensor to see
2+
to the eye) on your cp. Try shining a flashlight on your CPB, or covering the light sensor to see
33
the plot increase and decrease."""
44
import time
55
from adafruit_circuitplayground import cp

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_temperature_neopixels.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
"""THIS EXAMPLE REQUIRES A SEPARATE LIBRARY BE LOADED ONTO YOUR CIRCUITPY DRIVE.
2-
This example requires the simpleio.mpy library.
3-
4-
This example use the temperature sensor on the CP, located next to the picture of the thermometer
1+
"""
2+
This example use the temperature sensor on the CPB, located next to the picture of the thermometer
53
on the board. Try warming up the board to watch the number of NeoPixels lit up increase, or cooling
64
it down to see the number decrease. You can set the min and max temperatures to make it more or
75
less sensitive to temperature changes.
86
"""
97
import time
108
from adafruit_circuitplayground import cp
11-
import simpleio
129

1310
cp.pixels.auto_write = False
1411
cp.pixels.brightness = 0.3
@@ -17,9 +14,16 @@
1714
minimum_temp = 24
1815
maximum_temp = 30
1916

17+
18+
def scale_range(value):
19+
"""Scale a value from 0-320 (light range) to 0-9 (NeoPixel range, 10 total LEDs).
20+
Allows remapping light value to pixel position for light meter demo."""
21+
return round(value / (maximum_temp - minimum_temp) * 10)
22+
23+
2024
while True:
2125
# temperature value remapped to pixel position
22-
peak = simpleio.map_range(cp.temperature, minimum_temp, maximum_temp, 0, 10)
26+
peak = scale_range(cp.temperature)
2327
print(cp.temperature)
2428
print(int(peak))
2529

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_temperture.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This example uses the temperature sensor on the CP, located next to the image of a thermometer
1+
"""This example uses the temperature sensor on the CPB, located next to the image of a thermometer
22
on the board. It prints the temperature in both C and F to the serial console. Try putting your
33
finger over the sensor to see the numbers change!"""
44
import time

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_temperture_plotter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""If you're using Mu, this example will plot the temperature in C and F on the plotter! Click
22
"Plotter" to open it, and place your finger over the sensor to see the numbers change. The
3-
sensor is located next to the picture of the thermometer on the CP."""
3+
sensor is located next to the picture of the thermometer on the CPB."""
44
import time
55
from adafruit_circuitplayground import cp
66

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_touch.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
"""This example uses the capacitive touch pads on the CP. They are located around the outer edge
2-
of the board and are labeled A1-A6 and TX. (Audio is not a touch pad.) This example prints "Touched (pad)"
3-
to the serial console. Touch the touch pads to see the prints!"""
1+
"""This example uses the capacitive touchpads on the CPB. They are located around the outer edge
2+
of the board and are labeled A1-A6 and TX. (Audio is not a touchpad.) This example prints
3+
"Touched (pad)" to the serial console. Touch the touchpads to see the prints!"""
44
import time
55
from adafruit_circuitplayground import cp
66

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_touch_fill_rainbow.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""This example uses the capacitive touch pads on the CP. They are located around the outer edge
2-
of the board and are labeled A1-A6 and TX. (Audio is not a touch pad.) This example lights up all the
1+
"""This example uses the capacitive touchpads on the CPB. They are located around the outer edge
2+
of the board and are labeled A1-A6 and TX. (Audio is not a touchpad.) This example lights up all the
33
NeoPixels a different color of the rainbow for each pad touched!"""
44
import time
55
from adafruit_circuitplayground import cp

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_touch_pixel_rainbow.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
"""This example uses the capacitive touch pads on the CP. They are located around the outer edge
2-
of the board and are labeled A1-A6 and TX. (Audio is not a touch pad.) This example lights up the nearest
3-
NeoPixel to that pad a different color of the rainbow!"""
1+
"""This example uses the capacitive touchpads on the CPB. They are located around the outer edge
2+
of the board and are labeled A1-A6 and TX. (Audio is not a touchpad.) This example lights up the
3+
nearest NeoPixel to that pad a different color of the rainbow!"""
44
import time
55
from adafruit_circuitplayground import cp
66

Circuit_Playground_Bluefruit_cp_Library_Examples/cp_touch_tone_machine.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""This example requires seven wav files from the audio folder in Default_Files on the PyCon2022 GitHub
22
repo. Download the files and copy them into a folder named "audio" on your CIRCUITPY drive.
3-
Once copied, try touching the touch pads on A1-A6 and TX to hear a funky scale of notes!"""
3+
Once copied, try touching the touchpads on A1-A6 and TX to hear a funky scale of notes!"""
44
import time
55
from adafruit_circuitplayground import cp
66

0 commit comments

Comments
 (0)