![John Gallaugher](/img/default-banner.jpg)
- Видео 643
- Просмотров 762 064
John Gallaugher
США
Добавлен 17 дек 2009
Videos from Prof. John Gallaugher, Information Systems Department, Boston College. Swift/iOS, Making, Robotics, CircuitPython, MakeCode, Raspberry Pi.
Web: gallaugher.com/ Twitter: @gallaugher Instagram: @john.gallaugher Biz/Tech Book: gallaugher.com/book iOS Book: gallaugher.com/swift
Information about Prof. Gallaugher can be found at:
gallaugher.com/about-prof-john-gallaugher/
Web: gallaugher.com/ Twitter: @gallaugher Instagram: @john.gallaugher Biz/Tech Book: gallaugher.com/book iOS Book: gallaugher.com/swift
Information about Prof. Gallaugher can be found at:
gallaugher.com/about-prof-john-gallaugher/
Prof. G. Office Tour - Boston College
A visit to Prof. Gallaughers office at @bostoncollege is full of surprises. Be sure to stop by Fulton 460c when you return to campus. Try out the gadgets, grab some Skittles, and stay for a chat. Have a great semester!#Professor #stemeducation #maker #circuitpython #swiftui
Просмотров: 28
Видео
Make It Talk: Yoda talks & answers questions when touched (CircuitPython School)
Просмотров 972 часа назад
We'll add touch points to a Yoda doll so that he says phrases when one hand is touched, and answers questions "Magic 8 Ball"-style when the other hand is touched. The build can be easily adapted to any other project. Works with any Raspberry Pi Pico, including the Pico 2, we'll also use a microSD card reader to add gigabytes of extra storage for Pi playback. We'll work with an MPR121 12-pad cap...
Build a Portable Animated MadEye Prop (MakerSnack)
Просмотров 1899 часов назад
Learn to build a Magical Mad Eye that blinks, winks, and looks around. The product is portable, wearable, and rechargeable. This lesson will show you how to build both OLED and TFT versions using an Adafruit Feather M4 Express, which is a great board to use because it's small and supports pass-through lipo battery charging. Step by step instructions take you through installing and modifying cod...
Audio Play with Volume Control - A CircuitPython School Challenge Solution
Просмотров 92День назад
In this lesson we'll show a solution to the prior lesson's challenge: "Volume Controlled Audio Play". We'll start with all lights off on our board, and each press of Button A will add a light to the board. This will also adjust the volume. When all lights are on, volume is full, at 5 lights, volume is 50%, and when no lights are on, the volume is muted. Pressing any touchpad will play an mp3 fi...
Limit Audio Clicks and Pops, and Control Volume in CircuitPython (CircuitPython School)
Просмотров 115День назад
If you've experienced clicks or pops when playing audio, you're probably using a board that plays audio using audiopwmio. This lesson shows how to use audiomixer in CircuitPython to eliminate the clicks when each sound plays. You'll also learn how to programmatically set the volume of audio output. We'll show reusable code that works with wav files, and modify this to work with mp3 files. Part ...
Spin Neopixels, Volume Gauge, and List Comprehensions (CircuitPython School)
Просмотров 11514 дней назад
In this lesson we learn to spin NeoPixels with list slices, we learn to use list comprehensions, and we create a neopixel volume-style gauge. A great way to up your game with more advanced CircuitPython. Part of Prof. John Gallaugher's Physical Computing university course. Full playlist at bit.ly/circuitpython-tutorials
Slices and NeoPixels in CircuitPython
Просмотров 8814 дней назад
Let's go for a slice! Sequence Slices in CircuitPython, that is! We'll learn to use sequence slicing to easily update a group of neopixels with a single line of code. We'll learn about the start, stop, and step parameters of a slice. We'll use multiplication to repeat a light in a slice of neopixels. We'll learn how -n can be used to address the last n values of a slice, or all values except fo...
Play mp3 audio files in CircuitPython (CircuitPlayground Bluefruit & Raspberry Pi Pico code shown)
Просмотров 26314 дней назад
In this lesson we'll learn how to play mp3 files in CircuitPython. We learn how to see if your board supports mp3 files, why mp3 files sometimes make more sense than wav files for maker projects, and we'll write reusable code and show it working on a CircuitPlayground Bluefruit and Raspberry Pi Pico W board. Lots of additional tips and useful information is also shared. Part of Prof. John Galla...
Random Values and Non Repeating Randoms in CircuitPython
Просмотров 11414 дней назад
In this lesson we explore the most useful functions in the Python random library, including randint, randrange, and choice. We'll use what we learn to randomly sparkle a CircuitPlayground using CircuitPython, and we'll then learn to use a while loop to prevent any values from being repeated. We'll end by showing how you can use the code you've just written to create a holiday ornament by adding...
Drum Machine & Fruit Drums in CircuitPython
Просмотров 9114 дней назад
At the end of the prior lesson we posed the Drum Machine challenge. Here we show and describer a solution using lists & for loops to write efficient code that not only plays a sound associated with a touchpad, but also lights up lights in a specific color. We also demonstrate how you can connect wires to fruit & create a "fruit" drum kit. Part of Prof. John Gallaugher's Physical Computing cours...
You're Electric! Capacitive Touch (CircuitPython School)
Просмотров 9521 день назад
You're Electric! Capacitive Touch (CircuitPython School)
Who Moved My Stuff Alarm (a CircuitPython School challenge solution)
Просмотров 7521 день назад
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 ne...
Detecting Motion in CircuitPython Using the Built in Accelerometer in the CircuitPlayground boards
Просмотров 11121 день назад
Learn to detect motion using the LIS3DH accelerometer built into the CircuitPlayground Bluefruit and Express! CircuitPython makes this super easy. Learn to set up the accelerometer. Read acceleration across 3 axes. Unpack the three-values inside the returned tuple. Format printing of the three values into three neat columns. And print results using Mu. We'll also pose a challenge to create the ...
Print Plotter (a CircuitPython School challenge solution)
Просмотров 21321 день назад
This solution to the prior lesson's challenge shows how we can create a function that reads a sensor value, then generates printed output to mimic a plotter. This is a fun STEM Education challenge for any faculty looking to integrate algebraic thinking into programming exercises. The example code can work with a CircuitPlayground Express or Bluefruit. Part of Prof. John Gallaugher's Physical Co...
Print - Doing more with Python's Print statement (CircuitPython School)
Просмотров 9521 день назад
In this lesson we'll learn new printing techniques using f-strings, string formatters, we'll add comma separators to numeric values, we'll right-justify a column of numbers, we'll use a variable as part of a string format specifier, and we'll learn to create repeated strings. All of this will set us up for the "Print like a Plotter" challenge, presented at the end of this lesson. Part of Prof. ...
Fridge Alarm (a CircuitPython School challenge)
Просмотров 7928 дней назад
Fridge Alarm (a CircuitPython School challenge)
Light Sensor and the CircuitPlayground CircuitPython School
Просмотров 6028 дней назад
Light Sensor and the CircuitPlayground CircuitPython School
Off Now! A button press to immediately turn off sounds & NeoPixel lights (CircuitPython School)
Просмотров 6328 дней назад
Off Now! A button press to immediately turn off sounds & NeoPixel lights (CircuitPython School)
Alarm! Play Sound and Animate NeoPixel LED Lights (CircuitPython School)
Просмотров 8628 дней назад
Alarm! Play Sound and Animate NeoPixel LED Lights (CircuitPython School)
Pulsing NeoPixel lights and approximating decimal ranges in CircuitPython
Просмотров 7528 дней назад
Pulsing NeoPixel lights and approximating decimal ranges in CircuitPython
Python Modulo and Ternary Operators for Circular LED Patterns (CircuitPython School)
Просмотров 93Месяц назад
Python Modulo and Ternary Operators for Circular LED Patterns (CircuitPython School)
Fidget Dot - a CircuitPython School Challenge Solution
Просмотров 64Месяц назад
Fidget Dot - a CircuitPython School Challenge Solution
Scope and Functions with Return Values - Bring on Da Func 2 (CircuitPython School)
Просмотров 80Месяц назад
Scope and Functions with Return Values - Bring on Da Func 2 (CircuitPython School)
Bring on Da Func Part I (CircuitPython School)
Просмотров 83Месяц назад
Bring on Da Func Part I (CircuitPython School)
Clip a Speaker to a CircuitPlayground (CircuitPython School
Просмотров 110Месяц назад
Clip a Speaker to a CircuitPlayground (CircuitPython School
Bring on Da Noise - Playing .wav Files in CircuitPython
Просмотров 139Месяц назад
Bring on Da Noise - Playing .wav Files in CircuitPython
Better Buttons with Debouncing CircuitPython School
Просмотров 322Месяц назад
Better Buttons with Debouncing CircuitPython School
ifs, ands, and Buttons - Inputs and Conditionals (CircuitPlayground School)
Просмотров 150Месяц назад
ifs, ands, and Buttons - Inputs and Conditionals (CircuitPlayground School)
Importing and Using Colors from the Adafruit LED Animation Library (CircuitPython School)
Просмотров 151Месяц назад
Importing and Using Colors from the Adafruit LED Animation Library (CircuitPython School)
Flash & Loop NeoPixels with Lists in Python (CircuitPython School)
Просмотров 125Месяц назад
Flash & Loop NeoPixels with Lists in Python (CircuitPython School)
OOoh - I want a disco button!
Build one with this guide: bit.ly/disco-button
A button or keyboard button is usually held high by default (not pressed) and go "false" or 0 or "low"or ground when pressed. I created both for fun (3 keys) and it's easier to have voltage out there all the time and have pressed be low in my opinion. Both can work and buying stuff, we don't know always before looking into it.
The internal buttons use different resistors than one normally coded with external buttons. You may find this useful learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-digital-in-out Also note how the change impacts when buttons react - press vs release. The content presented is definitely what you want to do with internal buttons but if you see the later lesson on external buttons you’ll note the difference as is mentioned in the above Adafruit doc.
just a heads up, dont use steel wool, but instead brass or copper wool. steel is no bueno for tips
This was detailed and insightful yet super easy to understand. Well done
What a kind comment. I appreciate the encouragement. Hack on!
IMPORTANT! As of CircuitPython v.9, you need to have an EMPTY folder named "sd" on your CIRCUITPY volume so that your board knows to access your SD card. The "sd" folder is on your board volume, not the sd card itself, and that sd folder is empty - it doesn't have anything in it.
these videos are amazing thanks for making them
Glad you enjoy it!
Great Job!
Hey! You're this week's sticker winner. If you would like a "Make Something Awesome" sticker, DM or E-mail me (I'm easy to find online) with a postal address & I'd be happy to send one out, free of charge. Thanks for the comments - it helps the channel. Cheers!
@@profgallaugher Sent you a message. Thank you!
Nice!
Nice video!
Making progress ... thx for the lessons
You probably should mention that the usbmodem # may not stay the same between sessions. I guess it seems obvious but probably worth stating that users should ALWAYS PERFORM THIS STEP on PyCharm restart after doing the ls on /dev/tty. to verify the exact usbmodem# being used and setup TIO accordingly. Any idea if there's any way to setup a script that would do this process each time you open your cpb-project? Does PyCharm have any internal scripting abilities? Can Applescript be used with PyCharm?
Great Video!
Thanks!
Thank you
Thanks for the lessons! I tried my very best to follow the instructions (on a Mac) and was not successful. I could not find the circuitpython-stubs package. I just plan to use Thonny. I really love the simplicity of that software. I may try to use the VScode package in the future - it seemed to work OK but Thonny was super easy to play around with the example code - changing brightness ... and viewing the REPL.
No problem - you can use the code with any IDE. You'll see me use PyCharm's Terminal with Tio running. Many folks also use Mu, as well. The circuitpython-stubs should definitely be in PyCharm. Were you able to install the circup software in the prior lesson? You can do that from PyCharm's terminal, as well - shouldn't have to get into Windows Terminal. In fact, that's likely recommended. My guess is that if PyCharm didn't show up, pip3 wasn't installed, but unsure. Again, no need to work with PyCharm, but if you happen to find out what issue you faced, due LMK. I'll have students in class in the coming weeks so it's always good for me to be armed with additional advice. FYI: Adafruit has some GREAT support on their Discord forum. Sometimes someone will come at a problem assuming prior work, but I sometimes say "explain it to me like I know nothing - including key terms & their meaning" and most get it. Also: do know the reason I chose PyCharm is that code completion & error correction is really good with that software. Once again, welcome & have fun!
@@profgallaugher Yes circup installed and worked great. tio was installed just fine as well. I already have pip3 on my machine. Pycharm installed as well. I am on a Macbook so it is not a Windows issue. I do have several versions of Python on my Mac (3.9, 3.10 and 3.12) so I am wondering if that is what is wrong. I could not find the circuitpython-stubs package when I selected either of the installed versions in the "python interpreter" dialog box in Pycharm: version 3.9, or 3.12. 3.10 did not show in Pycharm. Maybe I will give it another try today.
@@profgallaugher OK - tried going through the steps again and this time it worked! Not sure what I missed before ...
So glad it worked out! Wish it was clearer what tripped you up, but trying again can often solve the problem :) Good luck & keep hacking!
Could I get a link to the google spreadsheet?
Sure thing - It's in the Description of this video.
Thanks for sharing your lessons! I struggled to get my board updated to the a newer bootloader but eventually got it to work using the Arduino IDE. Unfortunately, Adafruit's learning guide is quite confusing and not up-to-date. Not sure why my board's bootloader was so out of date since I purchased in fall 2023 but through another vendor (on sale) so it must have been old stock.
So glad you got the Bootloader set up. You are likely right - old stock. The Adafruit stuff I’ve gotten has always been very current. Also note that the Adafruit Discord is really good. Do let folks know you are a newbie. Even though I’m a PhD I sometimes say “describe it to me like I’m an inexperienced middle-schooler who knows none of the terms or concepts”. Hope you like the rest of the lessons. Many more to come. Cheers!
Having some trouble with the Connect app (both Mac & Android). For the Mac, when it starts it doesn't find my CPB. For the Android, it does find it and allows me to connect but the only modules displayed are Info & CircuitPython. I've tried with the other OS app not started but that doesn't seem to make any difference. I've also restarted the CPB. Any suggestions?
I’ve found this a bit inconsistent, too, but it always seems to come up. Restarting the Mac or iPhone and the device often works. Some have suggested if the device comes up in Mac or iOS Bluetooth settings to highlight it and then go to the info icon and forget the device, then restarting and reconnecting. I’ve found the Mac app as the most reliable. Being able to work with the Bluefruit app is a big plus. You should find working with WiFi on the pico w much more reliable. The folks on the Adafruit discord should also hear about any issues you are facing as they are keen to address anything they can uncover. Cheers.
Thx for the video,im learning swiftUI right now
Glad you enjoyed this. Keep hacking! More updates on SwiftUI coming soon. Am currently updating my CircuitPython course, but will absolutely be doing more with SwiftUI in the coming weeks.
dont use 3v3 for powering servos, use VBUS
Drop some knowledge, Homie. What are your reasons why? What are the consequences? Share on!
When using 'circup update -all' does it check to see what version of CircuitPython you're using and only update libraries to the latest version available for that CircuitPython version? Hopefully it doesn't update libraries to a newer CP version than you have loaded on your board. If it finds that you are using an earlier CP version, will it notify you that a newer version is available?
Yes, CircUp won't add files that are beyond the CircuitPython version you're using. And if you look at the output, you should see if a newer version of CircuitPython is available, so you can go get that from CircuitPython.org and install it on your board, then return to CircUp and upgrade if you'd like. Small updates usually aren't critical, but I try to keep my boards fairly current.
If anyone runs into problems installing CircUp, try opening the "Terminal" within PyCharm and doing the install from there. You may also need to install / upgrade pip3, as mentioned, but things should work. Also remember you can periodically run this command to upgrade circup: pip3 install --upgrade circup
I'm seeing a bit different operation of the serial console. I've installed TIO but didn't have to go through the TERMINAL process you mention around 14:45. When I run my code in PyCharm it automatically shows a RUN option in the list on the left side of the screen (shown below the PYTHON CONSOLE icon) and that just gives me my console with output /input from the CPB. Not sure I understand whether this is using TIO in the background or is working directly by some other means. What's up with this? Interestingly I did follow along in the Adafruit guide for setting up advanced serial connection on the Mac and it mentioned using screen. And while playing with this I did set that up (which included using the serial USB connection obtained with ls). Screen seemed to work fine, showing the output from the CPB. I then went into PyCharm and starting following this video. Is what I'm seeing due to the fact that I had setup Screen to access the CPBs serial connection?
You definitely do NOT want to use the run command in PyCharm. This is great for running code on your computer - which you would do if you were learning Python for data analysis or web development, but here we absolutely want to run the code on the CIRCUITPY board, so we ignore the "Run" command in PyCharm. In fact, once we start doing things outside of the simple print statement, that Run command will give you errors, since your computer doesn't have functions supported by CircuitPython, and it lacks hardware that's on your board. Screen can work as an alternative to Tio. Tio was recommended to me because if I unplug my board or press "reset", Tio will try to resume the connection, whereas I believe screen won't automatically re-connect.
For some reason the question about installing CircUp got lost when I released it for publication, but I've posted this comment in the CircUp video for anyone experiencing problems: If anyone runs into problems installing CircUp, try opening the "Terminal" within PyCharm and doing the install from there. You may also need to install / upgrade pip3, as mentioned, but things should work. Also remember you can periodically run this command to upgrade circup: pip3 install --upgrade circup
@@profgallaugherFor me I'm not seeing the code automatically execute when I do a save (the blue unsaved changes icon goes away but not seeing the execution). I need to press the Green RUN button in the header which then shows me the console output in the run window at the bottom (this works for output & input). It's definitely running on the CPB not locally. Not exactly sure why I'm seeing this but all of this is working without any TIO actions completed in terminal. Still not sure if what I'm seeing for console I/O is going through TIO or due to my screen interactions. Would like to try to get this straightened out. Any hints?
@@profgallaugher I tried installing Circup via the PyCharm terminal and that seems to have worked. I'm now seeing the installed version of 2.0.4 in both the PyCharm terminal and the Mac terminal. Aren't these the same? Isn't PyCharm just calling the standard Mac terminal? Why should there be a difference where the Circup install is executed from? At least it appears to be working now.
This is something I've found out after the fact, but it seems that a PyCharm project might be keeping a separate walled-off area apart from the Terminal. I found that installing CircUp from the Terminal inside PyCharm got things working.
Thanks for explaining the contents of the Definition - light bulb moment here. That helps so much. I've watched countless videos and picked up a lot, but this pulls it all together for me.
Glad it was helpful!
Have a new MacBook and trying to move the new CircuitPython .UF2 (9.1.1) to CPLAYBOOT. I'm new with Mac (Windows guy) and seem to be having a few problems. First, when I drag the new .UF2 it seems to dismount CPLAYBOOT before completing the copy & install (I get a notification saying that CPLAYBOOT has disappeared). If I bring CPLAYBOOT back up, it still has the older CP installed. Not sure why it's doing this. Earlier it did seem to get further with the .UF2 copy but it gave me a notification that I wasn't authorized to complete the copy/install (it was just a message, it didn't ask for a login or anything, it just didn't complete the .UF2 copy/install). Any idea why that would happen and what I need to do to ensure I have full access to do installs? I haven't had any other issues installing software. Appreciate any guidance. Thanks.
These videos are fun, and interesting, but I don't tend to watch them because I feel like rather than a tutorial or lesson, it's like a spoiler for how to solve a puzzle, or cheating in school. Not sure why I think that way, just pointing it out, because I feel like this channel should have more subs and comments, and maybe other people are thinking the same thing? Edit: I'm going to start at the beginning, look at your course, and try to find a way to learn the lessons, solve the puzzles myself, then go back and watch the videos.
Glad you think the lessons are fun but I’m not sure I understand the comment. There are lessons but also challenges. You can try the challenges - and should - before watching the solution. The solutions often show a new technique or tip, as well, so even if someone got an answer hopefully there is a tip in there. As a heads up, my students watch these outside of class, then in class I give them more challenges to complete. You are welcome to check out the weekly notes and challenges in the open Google Drive on my website gallaugher.com. The course canvas is closed but the drive is open. This technique is known as “flipped classroom” teaching.
Thanks for letting me know, looking forward to getting started with these this weekend :) I've been making things with Arduino and Micro Python for years, but my programming skills are lacking and getting worse from lack of practice and relying on GPT to write and fix code for me.
You'll find Python MUCH better to work with than C/Arduino. And it's a language that's used in many more modern contexts. C is dying, so I don't bother teaching this to my students. There are only a few performance reasons you'd choose Arduino over Python, and those are getting fewer as processors get faster. I used to take my students to Spice robot restaurant (bought by Sweetgreen), and all of their robotics were run using python. You should also find CircuitPython is more intuitive than Micro Python. And most importantly I find the support from the Adafruit Discord forum is just fantastic.
love the voices hahaha! your teaching style is phenomenal and easy to follow. Thank you for making these videos short and easy to code along to. I also like that you include graphical representations of what is happening in theory/on the web and on your device. Will be watching more of your videos.
Thanks for taking the time to write. More updates for the course are coming, soon. I'm currently updating my CircuitPython course, but I'm also teaching SwiftUI this Fall. I wanted to wait a bit for the WWDC24 betas to shake out before diving in. Very kind of you to share a positive word. Good luck with your learning journey!
Do you have the source code on GitHub? I have watched this series 2 times and still can't get the reviews section to work. They save but don't display in the app
Found where you posted the link in another video. Thank you for the series
Do you know any way to allow CircuitPython programming on an iPad? Adafruit does have a doc talking about iPad use but that only deals with sending code to a connected device (CPE I believe in the doc). It doesn't address actually programming it nor getting access to the REPL. Are you aware of any IDEs that run on the iPad that would allow direct programming with REPL I/O (most interested in CPB use to start)?
It's possible to upload any file from an iPad to a CIRCUITPY board, but the problem as you say is getting a full IDE that can do things like code completion & error correction. There are web-based IDEs. You might try: urfdvw.github.io/circuitpython-online-ide-2/ which is a project by River Wang. There's also a beta of an Adafruit WebIDE but I haven't done anything with it: learn.adafruit.com/webide/overview I doubt anything will be as robust as you'd get with a computer-based IDE. Good luck!
I was so excited for the new video lessons that I wanted to re-do all of the projects on your previous videos from last year before I began the new ones. Unfortunately, I ran into a problem with Mu. Ive never had it crash on me before, but it kept crashing so I uninstalled it, restarted my computer and reinstalled it. It opened and worked for maybe 5min before crashing again. Its been a few days now and it just tries to load for a minute or two before crashing every time I try to open the application. Has anyone else mentioned this? Is there an alternative than anyone might recommend? I have Thonny for another class, but I liked Mu more. Im still very new to this so thanks in advance to you and anyone in your audience who might be able to help.
Hi! In the new series I use PyCharm. You can find install videos for this and circus, which u also use, at the top of bit.ly/circuitpython-tutorials. I’m about 30 lessons into the update but have started with the CircuitPlaygrounds and haven’t gotten to the Pico yet. But you should be able to use the install videos to get set up. Check them out. PyCharm requires a bit more install work but is much better at error flagging and code completion. And circup automates adding and updating libraries. These are going to make things so much easier for my students. Good luck!
Hhahahhaha that's so cool! A fruit drum kit!
Followed your instruction for the Mac and got "command not found" on first try. After much fooling around, I looked at the Adafruit instruction and executed "pip install --upgrade circup", now it works.
Did you follow the “pip3 install circup” around 10:53? Would be really weird that the command wasn’t recognized if the first install happened. Thanks for sharing your fix!
You are an amazing teacher/instructor. Thank you for all you do!
Wow, thank you!
Is having the pressed and released in separate if statements instead of an if/elif structure going to create any unexpected behavior that you know of? In my testing they operated the same, but I was curious if there were any edge cases I'm not thinking of. if buttonA.pressed: pixels.fill(TEAL) press_count_A += 1 print(f"Press count A: {press_count_A}") if buttonA.released: pixels.fill(BLACK)
Good question. There is no special reason I didn’t put them in an if elif instead of two if’s. The difference is if it were in an elif then if the first if were true the second would not be evaluated two ifs will evaluate the second if even if the first is true. I don’t have equipment with me as I write this but the only case to consider is if you’d want to deal with simultaneous push but if so if put that in an if/and and treat it as a single condition. Cheers
Hej John , can we do the same with didSelectRowAt func ? i have built everything programmatically , but i have an error when i click on a row // Swift runtime failure: force unwrapped a nil value
Could be. Not at my machine to try it, but also, I’ve been teaching SwiftUi for the past two years so there is a chance this older content has a need to be updated. I’ll likely be sticking with SwiftUI, though. You’ll see me refreshing this playlist later this summer as I prep for my Fall class. Cheers bit.ly/prof-g-swiftui
I'm on a MacBook with Apple silicon and I am stuck on the print statement. When I enter tio dev/tty.usbmodem2101 in the PyCharm terminal, it returns zsh: command not found: tio. I went back to the prior video, reinstalled TIO and everything during the install worked as expected. This did not correct the error. Any help would be appreciated. I am a 64 year old newbie to programming so thank you for these videos.
That command suggests Tio was not installed. Try tio -version. Make sure it’s lower case. If you don’t get anything to is not installed. Does the ls command give you that usb number? You want to use the number you get, not mine. Also try restarting your Mac and unplugging and plugging your device back in. If all fails, there is awesome help on Adafruit Discord. adafru.it/discord. Be sure to post your solution. You’ll get it!
@@profgallaugher Thank you very much! I uninstalled everything and started over using this video ruclips.net/video/i7jEa2LyJtk/видео.html I was able to use that video of yours, combined with this one, and the problem has been solved. Thank you very much for your fast response and for making these great videos!
Is there anywhere I can get assistance with getting circup to work? I am using Windows 10 and have Python 3.12 installed on my machine. I installed the circup library and added the appropriate destination to my PATH variable, but I'm getting 'circup' is not recognized as an internal or external command. I've tried googling the issue but the only thing I can find on Circup is the stock standard install instructions.
I uninstalled circup and reinstalled it and that fixed the issue
So I assume you have sound this and if doesn’t help learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup/overview Ask on Adafruit Discord. There are great folks there who will help quickly. And when you have an answer do share what helped. Good luck! adafru.it/discord
@@profgallaugher Thanks! In case it helps others debug I uninstalled circup and reinstalled it, and that fixed the issue.
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!!!)
Neat! Thanks Prof Gallaugher for the shout out!
Great videos! I'm excited to watch more and create new projects! I have an Adafruit Circuit Playground Bluefruit board with an older version of the bootloader (version 0.2.11). I'm having trouble updating to the most recent version of CircuitPython by dragging and dropping the files. Could you please provide some guidance on how to overcome this issue? This statement shows up on the learn page at adafruit- “Your board's bootloader must be 0.6.1 or later to be able to load CircuitPython 8.2.0 or later.”Thank you in advance for any help you can provide.
Hi! Here is a document I prepared for my students a couple years back: docs.google.com/document/d/1J-Hmor7f2kaMpyntmG2dNOPeW21igF9wMnYT7VztReQ/edit and here is a more detailed doc from Adafruit learn.adafruit.com/adafruit-circuit-playground-bluefruit/update-bootloader. If you still run into probs, definitely check out their Discord channel. There are very friendly and helpful folks there. Cheers & good luck!
@@profgallaugher That did it! Thank you so much! How do I take your online classes?
Just follow along the videos in order at bit.ly/circuitpython-tutorials. I'm 28 lessons into updating the entire course for Fall. The last time I taught was Spring 23 (I've been on sabbatical this past year). The weekly lessons, challenges, and solutions are at Gallagher.com in the online folder for the course. The other material is behind the firewall because it's university canvas, but the weekly slides & solutions, plus the videos, are really nearly everything we cover, save being together in-person. You should be able to learn everything my students do through all of that. Cheers & tell others!
@@Bestcellmike1 Im so glad you figured this problem out. Im still struggling with it though. Ive tried the Adafruit guide for both the arduino and terminal solutions and then @profgallaugher 's google doc, but Im too inexperienced to be able to figure out what Im doing wrong. My CPB has 0.2.11 as well and Im using Windows 10. I cant make heads or tails of the command line/ terminal instructions. The Adafruit forums basically just validate my feelings, as other much more knowledgeable people have expressed similar frustrations. I havent found much in the way of a solution though, most posts just link back to the learn guide. I literally just downloaded Discord for this exact reason, but all the posts seem to link back to the Adafruit guide. What am I missing? I feel like it must be something obvious but Im too frustrated to see it. Id be very grateful for any pointers.
thought you were staying away from Mu. Matplotlib and TKinter and build a gui. More exciting to have something that works like a labview IMO.
Yes, Mu seems the easiest to see plotting but there are some more options I’m investigating. TodBot suggested a neat tool but it requires some extra installation and I want to avoid that. If you care to check it out, link is below. I really like PyCharm as a Mu alternative. They are so many common errors students make that Mu will catch or warn about. github.com/hacknus/serial-monitor-rust
Very nice link. Yah i fall back to Mu when things go screw, for a sanity check.
I've been developing professionally for 10+ years (Java & Cpp), and I'm a huge JetBrains fanboy. I'm working on a quick proof of concept in circuit python and I didn't want to mess around with MU. This is great. I really appreciate your attention to detail. It's going to help a lot of people dive into development.
Thanks so much! Glad you enjoyed it. Yes, PyCharm makes a BIG difference in catching simple errors that can trip up anyone but especially newbies, and the code completion is far better. Cheers!
As a total newby... am getting No Module Named board or digitalio... any suggestions?
Are you using CircuitPython and not microphone? Those modules are built into CircuitPython. They don’t need to be added to “lib”. So if you installed CircuitPython (earlier lesson) you should be fine. Just use the import statement in your code.
Also make sure you've installed the proper CircuitPython library for your board. For example: Raspberry Pi Pico W if you're using the "W" board, Raspberry Pi Pico for that board. Has that solved you issue? Good luck!
I understand using all caps for variable names that are constant like BLUE or ORANGE. Why isn't time_interval also named in all caps? We're plugging an unchanging value into it, so it seems like a constant to me, too.
Hi! Yes, you can absolutely choose to change this to all caps if you’d like. The reason you might see this in lowercase snake case is that it “could be” that a program would modify the time interval. So where as BLUE would never change, nor would ONE_SECOND, you might write a program that takes a time_interval and changes it by, say 0.1 seconds up or down if you press A or B. It ultimately is up to you, though. One thing about Python is that there aren’t really constants so all caps is just a stylistic choice. You *can* write code to change BLUE to a non-blue value. As an aside: a language like Swift (that’s the other course I teach) you can actually define a value as an unchanging constant. Swift is a “type safe” language, designed to prevent lots of runtime errors & that kind of enforcement is one way to do that. Hope that helps!
@@profgallaugher Great, thanks for the clarification!
Thanks for these tutorials. I would note that on the Circuit Playground Express you do NOT have to import all of these additional libraries for this touch pixel fill rainbow example to run. I wasn't able to track down a Bluefruit in a reasonable time frame so have gone with an Express. I was surprised that it worked just fine upon copying over and renaming the example code. From the docs: "For Circuit Playground Express, simply install CircuitPython to use this library - the library itself and all of its dependencies are built into CircuitPython for Circuit Playground Express." That said I've gone ahead and installed circup for future projects.
Thx for this! I’ve noticed that CircUp is aggressive in its imports and will often bring in libraries that might not be needed by code.py, but that *could* be used if a library calls another library. So I think it makes pretty broad decisions about imports. The learn guides on Adafruit for given techniques and products often list libraries that need to be used and those are usually a narrower set. If you were creating a project that was really tight on space it might make sense to pull out any libraries guide sure the project code doesn’t need. Do watch the output when running code. Sometimes you have to scroll up to see errors once code runs if your terminal window is not dragged taller. But if you get an error like “undefined <library name>” that likely means a key library is missing and needs to go into the “lib” folder. Also one thing about both CircyitPlaygrounds. They haven an additional optional library set “adafruit_circuitplayground” and there are some things you can do with this library that require less code, but those libraries are specific to those boards and code written calling these libraries wouldn’t work on other boards. So I’ve chosen to avoid them in the course because I want my students to be able to use techniques across all boards. For example, take code written for CiecuitPlaygrounds and run it on a Raspberry Pi Pico W. Most of the time you can do this for course techniques, with just a small tweak (like changing one line where lights are connected on a board). I’ll demo this later lessons when we cover the Pico. One notable exception is sound play. There are three extra lines you need to turn on the internal speaker of CircuitPlayground boards and those three lines don’t work on other boards. You’ll see me cover that in a later lesson, too.
@@profgallaugher Thanks for the reply; I appreciate it! I'm 63 and build props as a hobby, and I'm hoping to learn enough coding to do these things myself rather than rely on a friend or whatever.
On the Circuit Playground Express board I just got it takes a single push on the Reset button to put it into CPLAYBOOT mode. Powered up the board would play the included animation but would not mount on my Mac desktop as a CIRCUITPY volume. Copying the .uf2 file to CPLAYBOOT dismounted the volume which then came back as CIRCUITPY. Looking forward to further tutorials!
Glad you got things setup properly. Good luck hacking!
Hello from Xcode 16 and iOS 18! As Prof. Gallaugher alluded to, future enhancements from Apple might simplify your .onChange modifier: .onChange(of: selectedPhoto) { Task { if let newImage = try? await selectedPhoto?.loadTransferable(type: Image.self) { bipImage = newImage } else { print("Failed to set new image") } } }
You’re great! Thanks for this. I’ve been refreshing my CircuitPython course first, but will start the iOS course refresh around Aug. 1. I appreciate the update and I’m sure students will, too. Cheers!
The try/except imports might be less bewildering to beginners if you briefly explained the hardware differences between AudioOut and PWMAudioOut, and why PWM is required for boards without built-in DACs and speakers.
Thanks. My philosophy is to hold new topic introduction until it absolutely needs to be introduced. A course that assumes no prior programming & engineering is a pretty big lift, even for my bright students, so if we don't need to discuss DAC concepts (and why some boards have them & some don't), I've chosen to leave that out. You'll see this approach throughout the course. We don't do a "blink" because it's actually more complex than lighting up an entire set of on-board neopixels, plus it's not really something someone uses in a real project. And we put off discussions of resistors (which is often a first-step in many electronics courses) because we deliberately choose Qwiic/STEMMA-QT that hides lots of complexity & lets students build stuff quickly without having to worry about deeper details. We're covering things like scheduling & IoT in the "Prescription Box" when we finally need a single LED and students have been pretty ramped up with concepts so as not to be intimidated. What I'd actually like to see is a unified sound library from Adafruit that will hide this setup from the user. Audio is likely the least "cross platform" thing we do in CircuitPython, but it's definitely possible to produce libraries that make the right configuration decisions for simple audio output. The CircuitPython team is fantastic & they have a lot on their plate. Unsure if this is something they've got scheduled, but your idea prompts me to reach out & post a suggestion on a git page. Cheers.
I understand your approach, and I'm a big fan of your concise style, but in this video you spent a lot of time describing what you were doing, but not as much as usual on why. Just an extra sentence or two of hardware detail would have, in my opinion, justified the multi-library necessity. Something like, "The CircuitPlayground Express has a built-in audio circuit and can use the AudioOut library directly, whereas the CPBluefruit and Pico require a different technique called PWM which we'll dive into later." As a professor of complicated subjects myself (live audio engineering and design), I thought I'd share some constructive feedback.
I might be able to add this when introducing these concepts in the Raspberry Pi Pico portion of the course. Thanks & best wishes.
Thank you. Very helpful!
You're welcome!
Couple questions. First, is there any way to explore what's available in the community library bundle? How can you know easily find what's there without having to read through all the included libraries? Does anyone maintain a cheat sheet? Are there any community libraries that you find extremely helpful? Can CircUp work with the community bundle or just the standard Adafruit library bundle? I've always been a Windows user and have never liked Macs (long history, just my feelings). But for controller programming it certainly seems like there are some benefits. What Mac systems do you use? I need something fairly portable with reasonable memory. Can you recommend any mid price (or cheaper) Macs systems that work well for controller programming? Appreciate any suggestions. Thanks.
Hi Christopher. I don't use the Community Bundle much. The only time I used it was when I needed a scheduler for Raspberry Pi Pico & it wasn't yet available in CircuitPython. I haven't gotten to updating the "Medications Cabinet" build yet, but if there is an official scheduler library, then I will likely replace the community code with the official one. I'm not sure what is available in terms of examples, etc. You may get a better answer on the Discord community re: this, since there are more folks w/Community Bundle experience there (and likely many who have contributed to it). While I haven't used CircUp with the community bundle, it's referenced in the docs, here, so I imagine that it does work: github.com/adafruit/circup As far as Macs go. About 70-80% of our students use Macs & I teach an iOS class, so that's what I use. The built-in UNIX base has made some things easier. MacBook Air computers are light weight & the Mx chips are powerful. They're regularly upgraded. I'm still using an M1 variant on my computer. My understanding is that some of the new AI stuff might be more RAM intensive, since local LLMs are running locally for privacy concerns, so if you were thinking what to invest more in, I'd consider more RAM, although I don't have any specifics on "what's a good size". There are likely some posts covering this already, somewhere, though. I've been pretty much heads down trying to get the CircuitPython portion of my course revised so I can start on the SwiftUI stuff. I don't have a typical "academic summer" :) Hope that's useful. Cheers!
Thanks so much for your reply. So do you feel the M1 is still a reasonable processor? I really don't need the greatest, would rather save a few $ as long as it works fairly well. I can get a refurbished MacBook Pro M1 10 core CPU/16 core GPU 16G RAM 1TB SSD 14.2 Display for $1300 (excellent condition). That seems reasonable considering the cost of similar specs M2 or M3 MacBook Pros. I know this is over speced for doing development work but I also do video production and lots of other things so I believe this would be good for me. Do you believe the M1 could be at least viable for the next 3-5 years? Really appreciate any guidance. Thank you very much.
Mmm. always tough to make a decision for someone else. I'd hate to say go cheaper & then have you find out that some cool new feature can't run on old stuff. I'd definitely get an M-class machine. Not sure if M1s are still being sold. You can likely get a refurbed one, but the latest iPad came with an M4, so the upgrades are happening fairly quickly. You're likely best able to evaluate the financial pain vs. obsolescence risk quota. I have found that the lifespan of Macs was longer, but I think AI throws a wrench into old experiences since it's so processor & memory intensive, and that some of the models may leverage inference engines on the chips. Sorry I can't make an easy "get this!" recommendation. Good luck!
@@profgallaugherTotally understand. Thanks for your guidance though. It certainly looks like the M1 should work well for me at least for the next 3-5 years. I don't see anything that I currently do that it shouldn't do at least reasonably quickly. It's not perfect but for the reduced price I think it's worth a shot. I may wait till Prime day later this week to see if I can possibly shave off a couple more hundred. Thanks again.
@@profgallaugher Having some trouble getting Circup installed. I get to your 'pip3 install circup' cmd and this ends with the following: Installing collected packages: appdirs, urllib3, toml, semver, idna, findimports, Click, charset-normalizer, certifi, requests, update-checker, circup Successfully installed Click-8.1.7 appdirs-1.4.4 certifi-2024.7.4 charset-normalizer-3.3.2 circup-2.0.4 findimports-2.5.0 idna-3.7 requests-2.32.3 semver-3.0.2 toml-0.10.2 update-checker-0.18.0 urllib3-2.2.2 But I'm NOT seeing the 'successfully installed circup' message. And if I try to run a version command on circup, it says 'zsh: command not found: circup'. And, of course, the 'circup install -a' fails to run. What am I doing wrong? Appreciate any guidance.