Skip to content

Commit c64c01c

Browse files
committed
update branch
2 parents 2d79ca7 + 792ecbe commit c64c01c

118 files changed

Lines changed: 14065 additions & 215 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Hue_Controller/secrets.h
33
.idea
44
*.DS_Store
55
CircuitPython_Logger/secrets\.py
6+
.python-version

Adafruit_pIRKey/NEC_keyboard_example.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
import adafruit_dotstar
1111
import pulseio
1212
import board
13+
import usb_hid
1314

1415
led = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1)
1516

1617
# The keyboard object!
1718
time.sleep(1) # Sleep for a bit to avoid a race condition on some systems
18-
keyboard = Keyboard()
19+
keyboard = Keyboard(usb_hid.devices)
1920
keyboard_layout = KeyboardLayoutUS(keyboard) # We're in the US :)
2021

2122
# our infrared pulse decoder helpers

Adafruit_pIRKey/raw_code_keyboard/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
import adafruit_dotstar
99
import adafruit_irremote
1010
import time
11+
import usb_hid
1112

1213
# The keyboard object!
1314
time.sleep(1) # Sleep for a bit to avoid a race condition on some systems
14-
keyboard = Keyboard()
15+
keyboard = Keyboard(usb_hid.devices)
1516
keyboard_layout = KeyboardLayoutUS(keyboard) # We're in the US :)
1617

1718
led = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1)

Arcade_Button_Control_Box/Arcade_Button_Control_Box.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from adafruit_hid.keyboard import Keyboard
55
from adafruit_hid.keycode import Keycode
66
import board
7+
import usb_hid
78

89
# A simple neat keyboard demo in circuitpython
910

@@ -16,7 +17,7 @@
1617
controlkey = Keycode.LEFT_CONTROL
1718

1819
# the keyboard object!
19-
kbd = Keyboard()
20+
kbd = Keyboard(usb_hid.devices)
2021
# our array of button objects
2122
buttons = []
2223
leds = []

AutoSunglasses/code.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414

1515
import time
1616
import board
17-
import simpleio
17+
import pulseio
1818
from adafruit_circuitplayground.express import cpx
19+
from adafruit_motor import servo
1920

20-
servo = simpleio.Servo(board.A1)
21+
pwm = pulseio.PWMOut(board.A1, duty_cycle=2 ** 15, frequency=50)
22+
my_servo = servo.Servo(pwm)
2123

2224
cpx.pixels.fill((0, 0, 0))
23-
servo.angle = 90
25+
my_servo.angle = 90
2426

2527
while True:
2628
light_level = cpx.light
@@ -30,8 +32,8 @@
3032
else:
3133
cpx.pixels.fill((0, 0, 0))
3234
if light_level < 200:
33-
servo.angle = 90
35+
my_servo.angle = 90
3436
else:
35-
servo.angle = 0
37+
my_servo.angle = 0
3638

3739
time.sleep(0.25)

BLE_Crickit_Light_Switch/ble_crickit_light_switch.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BLE Crickit Light Switch
22
# Use with the Adafruit BlueFruit LE Connect app
3-
# Works with CircuitPython 4.0.0-beta.1 and later
3+
# Works with CircuitPython 5.0.0-beta.0 and later
44
# running on an nRF52840 Feather board and Crickit FeatherWing
55
# micro servo, 3D printed switch actuator
66

@@ -10,7 +10,10 @@
1010
import digitalio
1111

1212
from adafruit_crickit import crickit
13-
from adafruit_ble.uart import UARTServer
13+
14+
from adafruit_ble import BLERadio
15+
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
16+
from adafruit_ble.services.nordic import UARTService
1417

1518
from adafruit_bluefruit_connect.packet import Packet
1619
# Only the packet classes that are imported will be known to Packet.
@@ -22,7 +25,9 @@
2225
blue_led.direction = digitalio.Direction.OUTPUT
2326
red_led.direction = digitalio.Direction.OUTPUT
2427

25-
uart_server = UARTServer()
28+
ble = BLERadio()
29+
uart_service = UARTService()
30+
advertisement = ProvideServicesAdvertisement(uart_service)
2631

2732
UP_ANGLE = 180
2833
NEUTRAL_ANGLE = 120
@@ -35,17 +40,17 @@
3540
print("Use Adafruit Bluefruit app to connect")
3641
while True:
3742
blue_led.value = False
38-
uart_server.start_advertising()
43+
ble.start_advertising(advertisement)
3944

40-
while not uart_server.connected:
45+
while not ble.connected:
4146
# Wait for a connection.
4247
pass
4348
blue_led.value = True # turn on blue LED when connected
44-
while uart_server.connected:
45-
if uart_server.in_waiting:
49+
while ble.connected:
50+
if uart_service.in_waiting:
4651
# Packet is arriving.
4752
red_led.value = False # turn off red LED
48-
packet = Packet.from_stream(uart_server)
53+
packet = Packet.from_stream(uart_service)
4954
if isinstance(packet, ButtonPacket) and packet.pressed:
5055
red_led.value = True # blink to show a packet has been received
5156
if packet.button == ButtonPacket.UP and angle != UP_ANGLE: # UP button pressed

Bluetooth_Luminaries/code.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
import neopixel
66
import touchio
77
import adafruit_fancyled.adafruit_fancyled as fancy
8-
# from adafruit_ble.uart import UARTServer
9-
# for >= CPy 5.0.0
10-
from adafruit_ble.uart_server import UARTServer
118
from adafruit_bluefruit_connect.packet import Packet
129
from adafruit_bluefruit_connect.button_packet import ButtonPacket
1310
from adafruit_bluefruit_connect.color_packet import ColorPacket
1411

12+
13+
from adafruit_ble import BLERadio
14+
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
15+
from adafruit_ble.services.nordic import UARTService
16+
17+
18+
1519
NUM_LEDS = 24 # change to reflect your total number of ring LEDs
1620
RING_PIN = board.A1 # change to reflect your wiring
1721
CPX_PIN = board.D8 # CPX Neopixels live on pin D8
@@ -66,7 +70,11 @@
6670
offset_increment = 6
6771
OFFSET_MAX = 1000000
6872

69-
uart_server = UARTServer()
73+
# Setup BLE
74+
ble = BLERadio()
75+
uart = UARTService()
76+
advertisement = ProvideServicesAdvertisement(uart)
77+
7078

7179
def set_palette(palette):
7280
for i in range(NUM_LEDS):
@@ -101,17 +109,17 @@ def set_palette(palette):
101109
set_palette(palette_choice)
102110
offset = (offset + offset_increment) % OFFSET_MAX
103111

104-
if not uart_server.connected and not advertising:
105-
uart_server.start_advertising()
112+
if not ble.connected and not advertising:
113+
ble.start_advertising(advertisement)
106114
advertising = True
107115

108116
# Are we connected via Bluetooth now?
109-
if uart_server.connected:
117+
if ble.connected:
110118
# Once we're connected, we're not advertising any more.
111119
advertising = False
112120
# Have we started to receive a packet?
113-
if uart_server.in_waiting:
114-
packet = Packet.from_stream(uart_server)
121+
if uart.in_waiting:
122+
packet = Packet.from_stream(uart)
115123
if isinstance(packet, ColorPacket):
116124
cycling = False
117125
# Set all the pixels to one color and stay there.

CPB_ANCS/ancs_basecamp.bmp

113 KB
Binary file not shown.

CPB_ANCS/ancs_connect.bmp

113 KB
Binary file not shown.

CPB_ANCS/ancs_discord.bmp

113 KB
Binary file not shown.

0 commit comments

Comments
 (0)