File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Crickits/Crickit_Hello_World Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
2+ #
3+ # SPDX-License-Identifier: MIT
4+
5+ import time
6+ import audioio
7+ import audiocore
8+ import board
9+ import neopixel
10+ from adafruit_crickit import crickit
11+
12+ # Set audio out on speaker
13+ speaker = audioio .AudioOut (board .A0 )
14+
15+ # Start playing the file (in the background)
16+ def play_file (wavfile ):
17+ audio_file = open (wavfile , "rb" )
18+ wav = audiocore .WaveFile (audio_file )
19+ speaker .play (wav )
20+ while speaker .playing :
21+ pass
22+
23+ # NeoPixels on the Circuit Playground Express Light Blue
24+ pixels = neopixel .NeoPixel (board .NEOPIXEL , 10 , brightness = 0.3 )
25+ # Fill them with our favorite color "#0099FF light blue" -> 0x0099FF
26+ # (see http://www.color-hex.com/ for more colors and find your fav!)
27+ pixels .fill (0x0099FF )
28+
29+ while True :
30+ print ("Hello world!" )
31+ play_file ("hello.wav" ) # play Hello World WAV file
32+ crickit .servo_1 .angle = 75 # Set servo angle to 75 degrees
33+ time .sleep (1.0 ) # do nothing for a 1 second
34+ crickit .servo_1 .angle = 135 # Set servo angle to 135 degrees
35+ time .sleep (1.0 ) # do nothing for a 1 second
You can’t perform that action at this time.
0 commit comments