├── README.md ├── circuit-playground-part-1 ├── bike-light │ ├── bedazzle_bike_light.py │ ├── bike_light.gif │ ├── code.py │ ├── kitt.py │ ├── randomize_bike_light.py │ └── thumbnail.png ├── buttons.gif ├── buttons.jpg ├── circuit_playground_back.jpg ├── circuit_playground_front.jpg ├── circuitpy.png ├── downloads1.png ├── downloads2.png ├── downloads3.png ├── file_icon.png ├── file_icons.png ├── internet_of_things.gif ├── internet_of_things.mp4 ├── neopixels.gif ├── neopixels.jpg ├── neopixels2.gif ├── rgb.jpg ├── slide_switch.gif ├── slide_switch.jpg ├── tech-specs │ ├── cpx.svg │ ├── index.html │ ├── main.js │ └── style.css └── uf2.gif ├── circuit-playground-part-2 ├── cap_touch.jpg ├── coin.wav ├── cpx.gif ├── drum-machine │ ├── bass_hit_c.wav │ ├── bd_tek.wav │ ├── bd_zome.wav │ ├── drum-machine.gif │ ├── drum_cowbell.wav │ ├── elec_blip2.wav │ ├── elec_cymbal.wav │ └── elec_hi_snare.wav ├── file_icons.png ├── game_over.wav ├── jump.wav ├── light_sensor.jpg ├── mu.gif ├── mu.png ├── neopixels.jpg ├── oops.wav ├── plant-care │ ├── code.py │ ├── fancy_plant_sensor.py │ ├── plant-care.gif │ └── plotter_toggle.gif ├── plotter.png ├── screenshot_detected.png ├── screenshot_mode.png ├── speaker.jpg └── temperature_sensor.jpg ├── getting_started.pdf ├── hall-of-fame └── light_sensor.py └── press_release ├── logo_adafruit.png ├── press_release.pdf └── tour.jpg /README.md: -------------------------------------------------------------------------------- 1 | # Learn Hardware Programming with CircuitPython 2 | 3 | 4 | 5 | CircuitPython is a programming language designed to simplify experimenting and learning to program on hardware devices. It makes getting started with low-cost microcontroller boards easier than ever before. 6 | 7 | It adds hardware support for Python, so if you already have Python knowledge, you can easily apply that to using CircuitPython. If you have no previous experience, it’s really simple to get started! 8 | 9 | 10 | 11 | ## Course Link ## 12 | 13 | https://www.codecademy.com/learn/learn-circuitpython 14 | 15 | ## Course Creators ## 16 | 17 | 18 | 19 | 20 | 21 | [1]: http://i.imgur.com/wWzX9uB.png (twitter icon without padding) 22 | [2]: http://i.imgur.com/fep1WsG.png (facebook icon without padding) 23 | [3]: http://i.imgur.com/VlgBKQ9.png (google plus icon without padding) 24 | [4]: http://i.imgur.com/jDRp47c.png (tumblr icon without padding) 25 | [5]: http://i.imgur.com/Vvy3Kru.png (dribbble icon without padding) 26 | [6]: http://i.imgur.com/9I6NRUm.png (github icon without padding) 27 | 28 | 29 | 30 | 31 | [1.2]: http://www.twitter.com/marielsmusings 32 | [6.2]: http://www.github.com/marielfrank 33 | 34 | **Adafruit:** Limor Fried (limor@adafruit.com) 35 | 36 | **Adafruit:** Phillip Torrone (pt@adafruit.com) 37 | 38 | **Codecademy:** Sonny Li 39 | 40 | ### Discord ### 41 | 42 | [http://adafru.it/discord](http://adafru.it/discord) 43 | 44 | ## 1. Circuit Playground Express: Part 1 ## 45 | 46 | - [ ] `code.py` 47 | 48 | **Bike Light:** 49 | 50 | 51 | 52 | - [x] [`code.py`](circuit-playground-part-1/bike-light/code.py) 53 | - [x] [`kitt.py`](circuit-playground-part-1/bike-light/kitt.py) (by [ericgfx](https://www.codecademy.com/EricGrossDesign)) 54 | - [x] [`bedazzle_bike_light.py`](circuit-playground-part-1/bike-light/bedazzle_bike_light.py) (by [cephir909](https://www.codecademy.com/cephir909)) 55 | - [x] [`randomize_bike_light.py`](circuit-playground-part-1/bike-light/randomize_bike_light.py) (by [j_drury73](https://www.codecademy.com/j_drury73)) 56 | 57 | ## 2. Circuit Playground Express: Part 2 ## 58 | 59 | - [ ] `code.py` 60 | 61 | **Plant Care** 62 | 63 | 64 | 65 | - [x] [`code.py`](circuit-playground-part-2/plant-care/code.py) 66 | - [x] [`fancy_plant_sensor.py`](circuit-playground-part-2/plant-care/fancy_plant_sensor.py) (by [cephir909](https://www.codecademy.com/cephir909)) 67 | 68 | **The 808 Drum Machine** 69 | 70 | - [ ] `code.py` 71 | 72 | ### CircuitPython Cheatsheets ### 73 | 74 | * [Adafruit CircuitPython Cheatsheet](https://github.com/adafruit/awesome-circuitpython/blob/master/cheatsheet/CircuitPython_Cheatsheet.md) 75 | * Codecademy CircuitPython Cheatsheet (TBA) 76 | 77 | ### Hall of Fame ### 78 | 79 | * [x] [`light_sensor.py`](https://github.com/Codecademy/learn-circuitpython/blob/master/hall-of-fame/light_sensor.py) (by [sdliston](https://www.codecademy.com/sdliston)) 80 | 81 | ## Contribution Guidelines 82 | 83 | We'd love to have you contribute! 84 | 85 | Please note that this project is released with a [Contributor Covenant](https://www.contributor-covenant.org). 86 | By participating in this project you agree to abide by its terms. 87 | -------------------------------------------------------------------------------- /circuit-playground-part-1/bike-light/bedazzle_bike_light.py: -------------------------------------------------------------------------------- 1 | from adafruit_circuitplayground.express import cpx 2 | import time 3 | 4 | while True: 5 | if cpx.switch: 6 | # red blinkz stuff: 7 | count = 0 8 | while count <= 3: 9 | cpx.pixels.fill((255, 0, 0)) 10 | time.sleep(0.5) 11 | cpx.pixels.fill((0, 0, 0)) 12 | time.sleep(0.5) 13 | count += 1 14 | # bedazzle function: 15 | time.sleep(0.5) 16 | cpx.pixels[0] = (255, 0, 0) 17 | time.sleep(0.2) 18 | cpx.pixels[1] = (255, 85, 0) 19 | time.sleep(0.2) 20 | cpx.pixels[2] = (255, 255, 0) 21 | time.sleep(0.2) 22 | cpx.pixels[3] = (0, 255, 0) 23 | time.sleep(0.2) 24 | cpx.pixels[4] = (34, 139, 34) 25 | time.sleep(0.2) 26 | cpx.pixels[5] = (0, 255, 255) 27 | time.sleep(0.2) 28 | cpx.pixels[6] = (0, 0, 255) 29 | time.sleep(0.2) 30 | cpx.pixels[7] = (0, 0, 139) 31 | time.sleep(0.2) 32 | cpx.pixels[8] = (255, 0, 255) 33 | time.sleep(0.2) 34 | cpx.pixels[9] = (75, 0, 130) 35 | time.sleep(0.5) 36 | cpx.pixels.fill((0, 0, 0)) 37 | time.sleep(0.5) 38 | else: 39 | # shut it up: 40 | cpx.pixels.fill((0, 0, 0)) 41 | -------------------------------------------------------------------------------- /circuit-playground-part-1/bike-light/bike_light.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/bike-light/bike_light.gif -------------------------------------------------------------------------------- /circuit-playground-part-1/bike-light/code.py: -------------------------------------------------------------------------------- 1 | from adafruit_circuitplayground.express import cpx 2 | import time 3 | 4 | while True: 5 | if cpx.switch: 6 | cpx.pixels.fill((30, 0, 0)) 7 | time.sleep(0.5) 8 | cpx.pixels.fill((0, 0, 0)) 9 | time.sleep(0.5) 10 | else: 11 | cpx.pixels.fill((0, 0, 0)) 12 | -------------------------------------------------------------------------------- /circuit-playground-part-1/bike-light/kitt.py: -------------------------------------------------------------------------------- 1 | # K.I.T.T. Bike Light 2 | # 3 | # Use Button A to change color 4 | # Use Button B to change style 5 | # Use Slide Switch to power on/off 6 | # Ride safe and don't hassle the Hoff 7 | # 8 | # Created by Eric Gross. Sublime Text on MacBook Pro (5/27/2019) 9 | # Codecademy: Learn Hardware Programming with CircuitPython - Bike Light 10 | 11 | from adafruit_circuitplayground.express import cpx 12 | import time 13 | 14 | colorIndex = 0 15 | functionIndex = 0 16 | rainbow = ((255, 0, 0), (255, 85, 0), (255, 255, 0), (0, 255, 0), (34, 139, 34), (0, 255, 255), (0, 0, 255), (0, 0, 139), (255, 0, 255), (75, 0, 130), (0,0,0)) 17 | 18 | ###### Function to Change Color ###### 19 | def checkPress(colorIndex): 20 | if cpx.button_a: 21 | colorIndex += 1 22 | if colorIndex > 10: 23 | return 0 24 | return colorIndex 25 | 26 | ###### Function to Change Function ###### 27 | def functionPress(functionIndex): 28 | if cpx.button_b: 29 | functionIndex += 1 30 | if functionIndex > 2: 31 | return 0 32 | return functionIndex 33 | 34 | ###### Color and Blinking ###### 35 | def blinkLed(colorIndex, d = 0.5, ledIndex = 10, turnOff = True): 36 | if ledIndex == 10: 37 | cpx.pixels.fill((rainbow[colorIndex][0], rainbow[colorIndex][1], rainbow[colorIndex][2])) 38 | time.sleep(d) 39 | else: 40 | cpx.pixels[ledIndex] = (rainbow[colorIndex][0], rainbow[colorIndex][1], rainbow[colorIndex][2]) 41 | time.sleep(d) 42 | if turnOff == True: 43 | cpx.pixels.fill((0, 0, 0)) 44 | time.sleep(d) 45 | return 46 | 47 | def kitt(d = 0.1): 48 | global colorIndex 49 | colorIndex = checkPress(colorIndex) 50 | for x in range(0, 10): 51 | blinkLed(10, d, x, False) 52 | blinkLed(colorIndex, 0, x, False) 53 | time.sleep(d) 54 | colorIndex = checkPress(colorIndex) 55 | for x in range(9, -1, -1): 56 | blinkLed(10, d, x, False) 57 | blinkLed(colorIndex, 0, x, False) 58 | time.sleep(d) 59 | return 60 | 61 | def rainbowSpin(d = 0.1): 62 | global colorIndex 63 | for x in range(0, 10): 64 | blinkLed(colorIndex, d, x, False) 65 | colorIndex += 1 66 | if colorIndex > 10: 67 | colorIndex = 0 68 | return 69 | 70 | ########################## 71 | ###### Main Program ###### 72 | ########################## 73 | 74 | while True: 75 | if cpx.switch: 76 | functionIndex = functionPress(functionIndex) 77 | colorIndex = checkPress(colorIndex) 78 | if functionIndex == 0: 79 | blinkLed(colorIndex) 80 | elif functionIndex == 1: 81 | kitt() 82 | else: 83 | rainbowSpin() 84 | else: 85 | # shut it 86 | cpx.pixels.fill((0, 0, 0)) -------------------------------------------------------------------------------- /circuit-playground-part-1/bike-light/randomize_bike_light.py: -------------------------------------------------------------------------------- 1 | from adafruit_circuitplayground.express import cpx 2 | import random 3 | import time 4 | 5 | while True: 6 | if cpx.switch: 7 | color_tup = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) 8 | cpx.pixels[random.randint(0, 9)] = color_tup 9 | time.sleep(.5) 10 | cpx.pixels.fill((0, 0, 0)) 11 | time.sleep(.5) 12 | else: 13 | cpx.pixels.fill((0, 0, 0)) -------------------------------------------------------------------------------- /circuit-playground-part-1/bike-light/thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/bike-light/thumbnail.png -------------------------------------------------------------------------------- /circuit-playground-part-1/buttons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/buttons.gif -------------------------------------------------------------------------------- /circuit-playground-part-1/buttons.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/buttons.jpg -------------------------------------------------------------------------------- /circuit-playground-part-1/circuit_playground_back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/circuit_playground_back.jpg -------------------------------------------------------------------------------- /circuit-playground-part-1/circuit_playground_front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/circuit_playground_front.jpg -------------------------------------------------------------------------------- /circuit-playground-part-1/circuitpy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/circuitpy.png -------------------------------------------------------------------------------- /circuit-playground-part-1/downloads1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/downloads1.png -------------------------------------------------------------------------------- /circuit-playground-part-1/downloads2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/downloads2.png -------------------------------------------------------------------------------- /circuit-playground-part-1/downloads3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/downloads3.png -------------------------------------------------------------------------------- /circuit-playground-part-1/file_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/file_icon.png -------------------------------------------------------------------------------- /circuit-playground-part-1/file_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/file_icons.png -------------------------------------------------------------------------------- /circuit-playground-part-1/internet_of_things.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/internet_of_things.gif -------------------------------------------------------------------------------- /circuit-playground-part-1/internet_of_things.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/internet_of_things.mp4 -------------------------------------------------------------------------------- /circuit-playground-part-1/neopixels.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/neopixels.gif -------------------------------------------------------------------------------- /circuit-playground-part-1/neopixels.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/neopixels.jpg -------------------------------------------------------------------------------- /circuit-playground-part-1/neopixels2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/neopixels2.gif -------------------------------------------------------------------------------- /circuit-playground-part-1/rgb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/rgb.jpg -------------------------------------------------------------------------------- /circuit-playground-part-1/slide_switch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/slide_switch.gif -------------------------------------------------------------------------------- /circuit-playground-part-1/slide_switch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/slide_switch.jpg -------------------------------------------------------------------------------- /circuit-playground-part-1/tech-specs/cpx.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | circuit playground v2 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | -------------------------------------------------------------------------------- /circuit-playground-part-1/tech-specs/main.js: -------------------------------------------------------------------------------- 1 | const texts = { 2 | button1: { 3 | h1: "Button A", 4 | span: 'There are two momentary push buttons to change modes, indicate when to start or stop, modify behavior, etc.' 5 | }, 6 | slide: { 7 | h1: 'Slide Switch', 8 | span: 'The slide switch is near the center. There is a little nub that you can slide left or right.' 9 | }, 10 | neopixel: { 11 | h1: 'NeoPixels', 12 | span: 'There are 10 NeoPixels on the board that can display any color.' 13 | }, 14 | on: { 15 | h1: 'Green "On" LED', 16 | span: 'This LED indicates that the Circuit Playground Express is powered.' 17 | }, 18 | d13: { 19 | h1: 'Red "D13" LED', 20 | span: 'This LED is used for basic blinking.' 21 | }, 22 | button2: { 23 | h1: 'Button B', 24 | span: 'There are two momentary push buttons to change modes, indicate when to start or stop, modify behavior, etc.' 25 | }, 26 | reset: { 27 | h1: 'Reset Button', 28 | span: 'The reset button is at the dead center of the Circuit Playground Express. It re-starts your device (turning it off and back on).' 29 | }, 30 | speaker: { 31 | h1: 'Built-in Speaker', 32 | span: 'This mini speaker can play basic tones and audio files.' 33 | }, 34 | }; 35 | 36 | const blue = '#4C7EF3'; 37 | const black = '#000000'; 38 | 39 | window.onload = function () { 40 | 41 | Array.prototype.forEach.call(document.querySelectorAll('#selectors *'), (elem) => { 42 | elem.addEventListener( 43 | 'mouseover', 44 | (event) => { 45 | const innerDot = document.querySelector(`#dot-${event.target.id} #inner`) 46 | innerDot.setAttribute('fill', blue) 47 | elem.setAttribute('fill-opacity', 0.25); 48 | replaceCaption(texts[event.target.id].h1, texts[event.target.id].span) 49 | 50 | }); 51 | elem.addEventListener( 52 | 'mouseout', 53 | (event) => { 54 | const innerDot = document.querySelector(`#dot-${event.target.id} #inner`) 55 | innerDot.setAttribute('fill', black) 56 | elem.setAttribute('fill-opacity', 0); 57 | }); 58 | }); 59 | } 60 | 61 | /******** 62 | Helper Functions 63 | ********/ 64 | 65 | function replaceCaption(header, body) { 66 | const a = document.querySelector('#caption-a'); 67 | const b = document.querySelector('#caption-b'); 68 | if (a.classList.contains('hidden')) { 69 | a.querySelector('h1').innerText = header; 70 | a.querySelector('span').innerText = body; 71 | 72 | } else { 73 | b.querySelector('h1').innerText = header; 74 | b.querySelector('span').innerText = body; 75 | 76 | } 77 | a.classList.toggle('hidden'); 78 | b.classList.toggle('hidden'); 79 | } -------------------------------------------------------------------------------- /circuit-playground-part-1/tech-specs/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | overflow: hidden; 5 | background-color: rgb(33, 64, 85); 6 | font-family: "Oxygen", sans-serif; 7 | font-size: 14px; 8 | } 9 | 10 | #full-container { 11 | box-sizing: border-box; 12 | width: 100vw; 13 | height: 100vh; 14 | display: flex; 15 | flex-direction: column; 16 | justify-content: center; 17 | align-items: stretch; 18 | } 19 | 20 | svg { 21 | position: fixed; 22 | height: 100%; 23 | width: 100%; 24 | top: 0; 25 | left: 0; 26 | display: block; 27 | margin: auto; 28 | background: #204056; 29 | } 30 | 31 | #usable-container { 32 | position: relative; 33 | width: 100%; 34 | height: 100%; 35 | 36 | } 37 | .caption-container { 38 | position:absolute; 39 | bottom: 1em; 40 | background-color: rgba(255, 255, 255, 0.9); 41 | /* margin: 0% 13%; */ 42 | padding: 0.8em; 43 | text-align: center; 44 | /* transition-property: all; */ 45 | transition-duration: 0.75s; 46 | opacity: 0.8; 47 | border-radius: 5px; 48 | } 49 | 50 | .hidden { 51 | opacity: 0; 52 | } 53 | 54 | h1 { 55 | font-weight: bold; 56 | font-size: 1.125em; 57 | margin: 0 0 0.4rem 0; 58 | } 59 | 60 | span { 61 | font-size: 1em; 62 | } 63 | 64 | /*@media (max-width: 615px) { 65 | body { 66 | font-size: 13px; 67 | } 68 | .caption-container { 69 | /* margin: 0% 2.5%; 70 | } 71 | }*/ 72 | 73 | #selectors * { 74 | transition-property: fill-opacity; 75 | transition-duration: 0.4s; 76 | } 77 | 78 | #blah, #blah2 { 79 | 80 | display: flex; 81 | justify-content: center; 82 | 83 | } 84 | -------------------------------------------------------------------------------- /circuit-playground-part-1/uf2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-1/uf2.gif -------------------------------------------------------------------------------- /circuit-playground-part-2/cap_touch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/cap_touch.jpg -------------------------------------------------------------------------------- /circuit-playground-part-2/coin.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/coin.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/cpx.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/cpx.gif -------------------------------------------------------------------------------- /circuit-playground-part-2/drum-machine/bass_hit_c.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/drum-machine/bass_hit_c.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/drum-machine/bd_tek.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/drum-machine/bd_tek.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/drum-machine/bd_zome.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/drum-machine/bd_zome.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/drum-machine/drum-machine.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/drum-machine/drum-machine.gif -------------------------------------------------------------------------------- /circuit-playground-part-2/drum-machine/drum_cowbell.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/drum-machine/drum_cowbell.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/drum-machine/elec_blip2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/drum-machine/elec_blip2.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/drum-machine/elec_cymbal.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/drum-machine/elec_cymbal.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/drum-machine/elec_hi_snare.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/drum-machine/elec_hi_snare.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/file_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/file_icons.png -------------------------------------------------------------------------------- /circuit-playground-part-2/game_over.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/game_over.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/jump.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/jump.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/light_sensor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/light_sensor.jpg -------------------------------------------------------------------------------- /circuit-playground-part-2/mu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/mu.gif -------------------------------------------------------------------------------- /circuit-playground-part-2/mu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/mu.png -------------------------------------------------------------------------------- /circuit-playground-part-2/neopixels.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/neopixels.jpg -------------------------------------------------------------------------------- /circuit-playground-part-2/oops.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/oops.wav -------------------------------------------------------------------------------- /circuit-playground-part-2/plant-care/code.py: -------------------------------------------------------------------------------- 1 | from adafruit_circuitplayground.express import cpx 2 | import touchio 3 | from board import * 4 | 5 | touch = touchio.TouchIn(A1) 6 | 7 | while True: 8 | if cpx.switch: 9 | if cpx.button_a: 10 | print("Temperature:", cpx.temperature) 11 | if cpx.button_b: 12 | print("Light value:", cpx.light) 13 | else: 14 | if cpx.button_a: 15 | print("Moisture:", touch.raw_value) 16 | if cpx.button_b: 17 | if touch.raw_value > 1500: 18 | print("Water me!") 19 | else: 20 | print("I'm good, thanks!") 21 | -------------------------------------------------------------------------------- /circuit-playground-part-2/plant-care/fancy_plant_sensor.py: -------------------------------------------------------------------------------- 1 | from adafruit_circuitplayground.express import cpx 2 | from time import sleep 3 | import touchio 4 | from board import * 5 | 6 | # temperature and light sensors, plus light output and sound. thresholds to be adjusted as needed. 7 | 8 | while True: 9 | if cpx.switch: 10 | if cpx.button_a: 11 | print('Temperature: ', cpx.temperature) 12 | if cpx.temperature <= 21.0: 13 | temp1_count = 0 14 | while temp1_count < 3: 15 | cpx.play_tone(262, 1.0) 16 | temp1_count += 1 17 | cpx.pixels.fill((0, 102, 255)) 18 | elif cpx.temperature >= 35.0: 19 | temp2_count = 0 20 | while temp2_count < 3: 21 | cpx.play_tone(294, 1.0) 22 | temp2_count += 1 23 | cpx.pixels.fill((255, 51, 0)) 24 | else: 25 | cpx.pixels.fill((0, 255, 0)) 26 | sleep(0.5) 27 | cpx.pixels.fill((0, 0, 0)) 28 | 29 | if cpx.button_b: 30 | print('Light Value: ', cpx.light) 31 | cpx.pixels.fill((255, 255, 0)) 32 | sleep(0.5) 33 | cpx.pixels.fill((0, 0, 0)) 34 | 35 | else: 36 | #moisture sensor. fancy light output included. same thing on thresholds here. 37 | touch = touchio.TouchIn(A1) 38 | if cpx.button_a: 39 | print('Moisture Level: ', touch.raw_value) 40 | sleep(2.0) 41 | if touch.raw_value < 1500: 42 | cpx.play_tone(262, 1.0) 43 | cpx.pixels.fill((51, 204,51)) 44 | sleep(0.5) 45 | cpx.pixels[0] = (0, 0, 0) 46 | sleep(0.2) 47 | cpx.pixels[1] = (0, 0, 0) 48 | sleep(0.2) 49 | cpx.pixels[2] = (0, 0, 0) 50 | sleep(0.2) 51 | cpx.pixels[3] = (0, 0, 0) 52 | sleep(0.2) 53 | cpx.pixels[4] = (0, 0, 0) 54 | sleep(0.2) 55 | cpx.pixels[5] = (0, 0, 0) 56 | sleep(0.2) 57 | cpx.pixels[6] = (0, 0, 0) 58 | sleep(0.2) 59 | cpx.pixels[7] = (0, 0, 0) 60 | sleep(0.2) 61 | cpx.pixels[8] = (0, 0, 0) 62 | sleep(0.2) 63 | cpx.pixels[9] = (0, 0, 0) 64 | cpx.pixels.fill((0, 0, 0)) 65 | else: 66 | cpx.pixels.fill((51, 204, 51)) 67 | sleep(0.5) 68 | cpx.pixels.fill((0, 0, 0)) 69 | cpx.pixels[0] = (51, 204, 51) 70 | sleep(0.2) 71 | cpx.pixels[1] = (51, 204, 51) 72 | sleep(0.2) 73 | cpx.pixels[2] = (51, 204, 51) 74 | sleep(0.2) 75 | cpx.pixels[3] = (51, 204, 51) 76 | sleep(0.2) 77 | cpx.pixels[4] = (51, 204, 51) 78 | sleep(0.2) 79 | cpx.pixels[5] = (51, 204, 51) 80 | sleep(0.2) 81 | cpx.pixels[6] = (51, 204, 51) 82 | sleep(0.2) 83 | cpx.pixels[7] = (51, 204, 51) 84 | sleep(0.2) 85 | cpx.pixels[8] = (51, 204, 51) 86 | sleep(0.2) 87 | cpx.pixels[9] = (51, 204, 51) 88 | cpx.pixels.fill((51, 204, 51)) 89 | sleep(0.2) 90 | cpx.pixels.fill((0, 0, 0)) 91 | -------------------------------------------------------------------------------- /circuit-playground-part-2/plant-care/plant-care.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/plant-care/plant-care.gif -------------------------------------------------------------------------------- /circuit-playground-part-2/plant-care/plotter_toggle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/plant-care/plotter_toggle.gif -------------------------------------------------------------------------------- /circuit-playground-part-2/plotter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/plotter.png -------------------------------------------------------------------------------- /circuit-playground-part-2/screenshot_detected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/screenshot_detected.png -------------------------------------------------------------------------------- /circuit-playground-part-2/screenshot_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/screenshot_mode.png -------------------------------------------------------------------------------- /circuit-playground-part-2/speaker.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/speaker.jpg -------------------------------------------------------------------------------- /circuit-playground-part-2/temperature_sensor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/circuit-playground-part-2/temperature_sensor.jpg -------------------------------------------------------------------------------- /getting_started.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/getting_started.pdf -------------------------------------------------------------------------------- /hall-of-fame/light_sensor.py: -------------------------------------------------------------------------------- 1 | from adafruit_circuitplayground.express import cpx 2 | from time import sleep 3 | import touchio 4 | from board import * 5 | 6 | while True: 7 | if cpx.light < 10: 8 | cpx.pixels[0] = (10, 0, 0) 9 | cpx.pixels[9] = (10, 0, 0) 10 | for i in range(1, 9, 1): 11 | cpx.pixels[i] = (0,0,0) 12 | elif cpx.light < 35: 13 | for i in range(2, 8, 1): 14 | cpx.pixels[i] = (0, 0, 0) 15 | cpx.pixels[1] = (10, 5, 0) 16 | cpx.pixels[8] = (10, 5, 0) 17 | cpx.pixels[0] = (10, 0, 0) 18 | cpx.pixels[9] = (10, 0, 0) 19 | elif cpx.light < 50: 20 | for i in range(3, 7, 1): 21 | cpx.pixels[i] = (0, 0, 0) 22 | cpx.pixels[1] = (10, 5, 0) 23 | cpx.pixels[8] = (10, 5, 0) 24 | cpx.pixels[0] = (10, 0, 0) 25 | cpx.pixels[9] = (10, 0, 0) 26 | cpx.pixels[2] = (10, 10, 0) 27 | cpx.pixels[7] = (10, 10, 0) 28 | elif cpx.light < 200: 29 | for i in range(4, 6, 1): 30 | cpx.pixels[i] = (0, 0, 0) 31 | cpx.pixels[0] = (10, 0, 0) 32 | cpx.pixels[9] = (10, 0, 0) 33 | cpx.pixels[1] = (10, 5, 0) 34 | cpx.pixels[8] = (10, 5, 0) 35 | cpx.pixels[2] = (10, 10, 0) 36 | cpx.pixels[7] = (10, 10, 0) 37 | cpx.pixels[3] = (0, 10, 0) 38 | cpx.pixels[6] = (0, 10, 0) 39 | elif cpx.light > 200: 40 | cpx.pixels[1] = (10, 5, 0) 41 | cpx.pixels[8] = (10, 5, 0) 42 | cpx.pixels[0] = (10, 0, 0) 43 | cpx.pixels[9] = (10, 0, 0) 44 | cpx.pixels[2] = (10, 10, 0) 45 | cpx.pixels[7] = (10, 10, 0) 46 | cpx.pixels[3] = (0, 10, 0) 47 | cpx.pixels[6] = (0, 10, 0) 48 | cpx.pixels[4] = (10, 10, 10) 49 | cpx.pixels[5] = (10, 10, 10) 50 | print(cpx.light) 51 | -------------------------------------------------------------------------------- /press_release/logo_adafruit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/press_release/logo_adafruit.png -------------------------------------------------------------------------------- /press_release/press_release.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/press_release/press_release.pdf -------------------------------------------------------------------------------- /press_release/tour.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-circuitpython/ff72d1cc9d66f2139e6468e62d1027bebb933e1f/press_release/tour.jpg --------------------------------------------------------------------------------