File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
Adafruit_Prop_Maker_FeatherWing
Prop_Maker_3W_LED_Simpletest
Prop_Maker_Audio_Simpletest Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 1- # SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
1+ # SPDX-FileCopyrightText: 2019, 2023 Kattni Rembor for Adafruit Industries
22#
33# SPDX-License-Identifier: MIT
44
55"""Simple rainbow swirl example for 3W LED"""
6+ import time
67import pwmio
78import board
8- from rainbowio import colorwheel
99import digitalio
1010
1111enable = digitalio .DigitalInOut (board .D10 )
1212enable .direction = digitalio .Direction .OUTPUT
1313enable .value = True
1414
15+
16+ def colorwheel (pos ):
17+ if pos < 0 or pos > 255 :
18+ return 0 , 0 , 0
19+ if pos < 85 :
20+ return int (255 - pos * 3 ), int (pos * 3 ), 0
21+ if pos < 170 :
22+ pos -= 85
23+ return 0 , int (255 - pos * 3 ), int (pos * 3 )
24+ pos -= 170
25+ return int (pos * 3 ), 0 , int (255 - pos * 3 )
26+
27+
1528red = pwmio .PWMOut (board .D11 , duty_cycle = 0 , frequency = 20000 )
1629green = pwmio .PWMOut (board .D12 , duty_cycle = 0 , frequency = 20000 )
1730blue = pwmio .PWMOut (board .D13 , duty_cycle = 0 , frequency = 20000 )
2235 red .duty_cycle = int (r * 65536 / 256 )
2336 green .duty_cycle = int (g * 65536 / 256 )
2437 blue .duty_cycle = int (b * 65536 / 256 )
38+ time .sleep (0.05 )
Original file line number Diff line number Diff line change 1- # SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
1+ # SPDX-FileCopyrightText: 2019, 2023 Kattni Rembor for Adafruit Industries
22#
33# SPDX-License-Identifier: MIT
44
55"""Simple example to play a wave file"""
66# This example only works on Feathers that have analog audio out!
77import digitalio
88import board
9- import audioio
109import audiocore
1110
11+ try :
12+ from audioio import AudioOut
13+ except ImportError :
14+ try :
15+ from audiopwmio import PWMAudioOut as AudioOut
16+ except ImportError :
17+ pass # not always supported by every board!
18+
1219WAV_FILE_NAME = "StreetChicken.wav" # Change to the name of your wav file!
1320
1421enable = digitalio .DigitalInOut (board .D10 )
1522enable .direction = digitalio .Direction .OUTPUT
1623enable .value = True
1724
18- with audioio . AudioOut (board .A0 ) as audio : # Speaker connector
25+ with AudioOut (board .A0 ) as audio : # Speaker connector
1926 wave_file = open (WAV_FILE_NAME , "rb" )
2027 wave = audiocore .WaveFile (wave_file )
2128
You can’t perform that action at this time.
0 commit comments