Who Moved My Stuff Alarm (a CircuitPython School challenge solution)
HTML-код
- Опубликовано: 10 сен 2024
- Use your knowledge of the accelerometer and CircuitPython programming to build an alarm that detects when an item has been jostled (e.g. if someone is trying to mess with something they shouldn't), and if so, set of an alarm which pulses NeoPixel LED lights and plays a siren sound through the CircuitPlayground's speakers. Works on an Express or Bluefruit device. We'll also learn to work with nested compound conditionals, and to use the abs() function.
Part of Prof. John Gallaugher's Maker Electronics programming course. Full playlist at bit.ly/circuit...
just what i needed for my gate, thanks
Glad I could help!
I am curious about just how the flashy lights interleave with the sound playing. The application I've put together is a bit different to your example in that I am streaming stereo 44.1k via I2S serial to an external DAC to implement a doorbell with swirly multicolor lights using an rpi pico. My feeble little septuagenarian brain thinks there must be enough time between transmitting each I2S packet for the lighting code to run, but I can't quite work out why these two processes share clock cycles transparently... Or so it seems. Any insight you might share would be much appreciated. I'm finding Python to be syntactically simple in the same way that hyperbolic orbital geometry is simple. Most of the code I've written over the last 40 years was in Lisp, BTW, quite a paradigm shift... Question aside, I really enjoy your teaching style!!!
I’m not sure exactly how the processor slices the code but there doesn’t seem to be any delay in executing functions while AudioOut.playing. Calling a function in that loop will execute a function but that called function runs to completion if the audio stops before the function is done. But some sort of processing handoff happens because there is otherwise no delay between the “concurrent” execution of continuous sound play and the called function. For more detail the library code is open source and on GitHub and there are also maintainers on the Adafruit Discord who can likely fill you in on details if you’d like. So glad you are enjoying the course. Cheers.
@@profgallaugher Thank you, I thought there was something bustling behind the curtain; Time to dive into the source code. Now for extra credit: Do you know how Limor got her nickname?
Ada Lovelace is considered "The First Programmer" - you can find out more information here: findingada.com/about/who-was-ada/. We celebrate Ada Lovelace Day as the second day in Oct. each year. I usually have my students do something fun, like this example from my SwiftUI class: ruclips.net/video/IjOvFaJyfL4/видео.html Here is a VERY old video I shared with students years ago that mentions this: ruclips.net/video/IjOvFaJyfL4/видео.html I'm pretty hardcore about promoting diversity in computing. You can find out some ideas here: profgallaugher.substack.com/p/things-all-can-do-to-encourage-diverse
@@profgallaugher I knew you be would right on the money, but I hadn't planned on you being of the same mind as me regarding diversity. The women I worked with in my professional career were always there to save me from myself, but it always bothered me they were in what were called "menial" jobs with much lower pay. I realized a few years ago that I have been a feminist for most of my life. World War 2 was essentially won by the women computers at Bletchley Park, the work of Alan Turing notwithstanding. The list goes on and on... Most of the girls ran rings around me in the Lisp forums on CompuServe. Cheers! (Thanks for the links!!!)