 Hello everyone and welcome to a circuit Python day chat with cat knee Jeff and Dan and today We are going to be talking about circuit Python and specifically Somebody's got YouTube running It happens every time Today we're going to be talking about circuit Python and talking about keyboards specifically in circuit Python Feel free to ask any questions in the YouTube chat the twitch chat or discord We'll be paying attention to discord, but we've got folks that are monitoring all of them So we'll be able to see all the questions Let us know If you have any questions about what we're talking about or anything about circuit Python 7 features Overall, and we'll see what we can do So with that I will introduce myself and then I will let everybody else introduce themselves I am cat knee. I work with Adafruit on circuit Python I mostly handle the libraries, although I've actually done a couple of recent Changes to the core, which is my first contribution to core circuit Python. That was a lot of fun but I handle all the libraries and We'll be talking today about the macro pad library, which I wrote for the Adafruit macro pad So Jeff why don't you introduce yourself? Hi, I'm Jeff. I also work for Adafruit on circuit Python I came on board to work on the core, but I've branched out and I do libraries and learn guides and things like that and Yeah, just What else should I say? I think that works, okay, Dan go ahead I'm the third I'm Dan Halbert I work also on circuit Python mostly for the on the core and I've been doing it for just about a Year it's a year this I'm not a year four years this month since 2017. I was gonna say Dan You've been here a lot longer than I right not a year. I don't know why I said a year 2017 has been four years. Wow. That's been a long time been a long time. Yeah, and I'm really happy to doing that and I'm happy to have these Katnia and Jeff with me to do this to do this show and we were love to hear your questions And and also we're gonna give you some intro stuff, but feel free to ask questions All right Excellent, so now that you've met everybody will go ahead and get started so the thing that I want to talk about today is the Adafruit circuit Python macro pad library and with Discussing that the first thing is to talk about the Adafruit macro pad, which is a microcontroller It's an RP 2040 on A board that has 12 keys and a 3x4 grid each of those keys has a neopixel behind it His key sockets rather and a display it has a rotary encoder with a switch It has a little speaker on it. I'm trying to think what else little red LED But the there you go. That's what it looks like So it it I don't actually don't have one without keys on it. It comes without the keys and you You would add the keys to it Along with key caps if you felt like it And it's super easy to do they just pop right in to the sockets and so what we wanted to do was write a library that wrapped everything in To one place So it was easy to use the keys and the display and the rotary encoder and everything all just without all the setup Because to use all of this hardware With what to use hardware with circuit Python you have to tell circuit Python where to look for that hardware or it doesn't know That you're trying to do something with it So there's always a little bit of setup when you're talking to other bits of hardware So with this many features there was a lot of setup So we did all that in one place So the The macropad library supports the display the rotary encoder the rotary encoder switch the key switches the neopixels the little red LED and the speaker in terms of hardware support and One of the features that we included is Rotation support rotation is fairly difficult to do if it was only the display and the keys It would have been very simple But actually remapping neopixels is a whole other situation. So the the macropad normally sits like this By default and as you see this one is rotated 90 degrees That was easy to do because of the library I was able to just set it up and tell it to rotate 90 degrees, but I'll talk about that again in a minute There's also tone and wave playback support even though the wave playback is a little buggy on the RP 2040 at the moment, but the The the support is there for it the library also wraps in HID and MIDI So if you want to use It as a keyboard or a mouse or as a MIDI controller, you can do that using the macropad library There are some features of MIDI. I think that are not included, but all the most common used features are there Um, it makes displaying an image or lines of text super simple basic lines of text this This version here does not use it uses something else to actually display this text Because this is a little more complicated Um, and there's a debounced version of the encoder switch Which means you can address it as pressed and released and do something different on each of those um Each of those things if you feel the need um So That is uh that covers all the features um And one of the things I wanted to talk about was my experience is writing the library In terms of issues that I ran into Because everybody loves bugs So um, the first thing I ran into was the reason that I specified the pixel mapping being difficult For rotation is that when I initially did the rotation, I thought I was super slick And I rearranged the keys for each of the possible rotations And the display is pretty easy to rotate. Um And so I did those two things And and shipped it said oh, we've got rotation support And uh one of our own uh paint your dragon philby Uh said hey, um, what about the neopixels? And I thought oh boy, I totally forgot Um, so I had a lot of help with that. Uh the led animation library actually already has pixel mapping in it for uh doing grids and so on and so what we did was we had we adapted a very uh light version Of that into the macropad library. So it's actually called pixel map light. Um, that's why And uh now the neopixels also rotate because they they start here and go this way and um Go across and then they end here And so you can't just it's and it's just it's just one pin So and they're and they're subscripted. Um, meaning they they each have a number within That space, but you you you can't just Tell it start here and end here instead doesn't work that way. Um With the keys it was simple because you just create a different Setup with the keys in a different order that was easy enough and the display you just tell it to rotate 90 degrees and it does Um, so initially the neopixels did not work and now they do which is excellent Um, and then more recently um One of uh jp tried to run the macropad off of a usb power source during um The actually was for the aida box unboxing And found out it didn't work Uh, and so messaged me a few hours beforehand and said hey by the way This doesn't work. So he figured out a whole work around for that But at the same time I said this this is this should work You should be able to run this off of a usb power source. There's no reason why it shouldn't and it turns out um if you create The hid keyboard object It wants there to be an hid connection It wants to know that there's something hid on the other end and if it doesn't find it It gives a very obtuse warning um, which I would never have figured out. Thank you to dan For knowing where to start with that one because the only warning I had was on that itty bitty little screen So I had like half the error And dan figured it out. So we moved the creation of the keyboard object into the actual like when you call the keyboard um And that made it so that it's not created automatically on import, which is what it was doing initially And now that it's not automatically created on import You can plug it into a usb power source as long as you're not using hid And run it. So the latest um macropad project that went up was a Game designed by phil b and he was able to power that off of the usb power source and use the macropad library um, so that all works, uh, however We found out that we sort of broke The way that one of the types of hid things works the one that sends strings And uh So then we had to fix that and initially thought it was just an indentation problem And that wasn't it and then finally figured out that it was duplicating Creating something so we used some different code And made that work and again dan figured all that out and fixed that dan knows hid much better than the rest of us um So that's that's about It I guess with uh the overview of the library and and my experiences with writing it um I guess we can Go ahead and take a look at some demos So this first one There's no guide yet. Um, because i'm still not Still not happy with my uh With my shortcuts, but um what this is going to be is a um Sort of a text expand there used to be an app called text expander which may still exist And essentially you could type out a you you program it to have initialisms or acronyms in it And then you type out the little shortened version and hit enter and it would make it big um into a whole sentence So for working tech support it was amazing Because there was so many times you type the exact same thing Over and over and so that made it a lot faster. And so I've on github. I typed a lot of the same stuff a lot um So I thought you know instead of doing a Hot key thing that is shortcuts because i'm so used to typing shortcuts on my keyboard I can't imagine like trying to put in my brain to reach out and Tap the macro pad to copy something so I am instead doing um Sort of a text expander thing where it's uh on the display. It's shortened versions of the thing that it will actually type out Um, the first one is thank you for your contribution. Uh, the second one is thank you for the fix There's a lot of thank yous I'm trying to think what the rest of them are. Um So you can't even remember what they are. It looks good to me on one of them did not test um, I suggested or included some suggestions below um Towards the bottom, uh, this one just says nice. This one says closing. This one does thumbs up This is uh, the taco emoji. It's an in joke, but I will let you in um It turns out if you type colon t To get the thumbs up emoji the first thing that pops up is taco And so when one of our uh, really good friends Um, who has helped us out with a ton of stuff summer soft Was replying to a pr of mine taco popped up and he went with it So now we do tacos instead of thumbs up So I included both um But one of the features I want to point out about this uh program Which I talked about on show and tell earlier this week is I have a big tendency to Fidget with the macropad if it's sitting on my desk or really anything that has clicky things and lights up um and so I um included what I'm calling fidget mode Which is uh, you can't see the red led, but you can see my finger is red. Um from it Uh, so it's on right now So I can press these buttons which light up and nothing is sending to my computer And that's the one thing I always hated about hid projects and always disabled the hid portion immediately is that if it's on my desk And it lights up i'm probably going to press it And that means i'm sending things to my computer all the time not meaning to So fidget mode is currently enabled if I press the rotary encoder switch it turns it off Turns it back on so the other features of this is each key lights up when I press it And it also as you see highlights the um The shortcut And you can't see it. Um, this actually says shortcuts with a white background and when it's a white background with black text It doesn't show up on this camera. Um, but that's what it does is it shows it as a white background with black, uh text and it's It's not great because If you press the wrong one, you've already pressed it Um, but it is an indicator of what you've pressed. I'm I'm debating on actually adding a delay to sending Um Just so that when you press it you see what it is and if it's the wrong one you go, I press the right one Um, I really wanted it rotated. I like the rotation because I don't have to um look over the keys to see the display But you can't Outlay or lay out a a four by three grid on the display with really any Length to the labels So that's the other reason why they're they're laid out in groups of four Um, each one of those represents a row and the lines between them differentiate. So, you know, which Rows are which um I have another demo as well We can take a look at here zoom out And this one is not hid um It uh simply it says key presses at the top again. It's not showing black text on white background. Um, this one lights up rainbow keys And displays the key being pressed on the display And when you toggle it it turns the rainbows off So you can mash all the buttons and they all show up On the display if that's the route you wanted to go um And that was just a simple demo. This was actually adapted from an initial simple demo where the key just lit up when you pressed it um, the demo that it shipped with Showed the key presses Um on the screen and I wanted to uh, that's Arduino, it's not circuit python. So I wanted to do a circuit python version of it So that was this is using the display i o layout library the grid layout um For uh displaying the key presses It makes displaying stuff in a grid on a display super easy uh, so take a look at that if you're ever interested in Doing this stuff like for example Laying out key labels So I think it's a really great companion to the macropad library because If you are using it as a macropad you often want to show on the display what it is that your macropad keys do um And that's uh pretty much What I have I didn't get a chance to set up any more. Um Any more demos i'm taking a look at discord scene if we have any questions. I don't see any yet We had some uh interesting comments though talking about a foot operated Touchpad that you have to use barefoot And kelly stratton says fidget mode is brilliant which I totally agree with and uh A bunch of taco discussion and two three three one puppy commiserated About um your efforts to get the rotation of the neopixels right So yeah better you than us That's that's valid Luckily I had help because I would have been lost in the water there So, uh, let's see I can rotate these there we go. Um Yeah, I would I would have been lost in the water but I had help from uh Uh my partner who goes by creola on discord and github I think And uh, she actually wrote the led animation library as well um, so mapping pixels was quite natural To to happen there. So that worked out. Um, it actually went really fast once we realized we needed to do it Um So yeah, so the macro pads a lot of fun. Um It can do all kinds of stuff Both light up, you know simple demo stuff and hid stuff um jp's written a couple of midi Examples that to use it as midi midi controller to use it With um different different midi applications Um, and it's worked out really well Uh one's called ableton live and it actually communicates Uh both both directions back and forth. Um, so the leds are uh responding to ableton versus um You writing code for the neopixels that sort of thing. So there's there's a lot you can do with it. Um and uh It also like I said plays tones. So, um, we did a braille keycaps um example where, uh, knowing Pedro printed um printed bail braille keycaps for the um For the macro pad keys and then each of them also played a tone So, um, you could Also associate the tone. Uh, it's just like another level of accessibility. Basically. Um, and I created a basic tone keypad. Um as well that doesn't do hid, but again, that's uh super simple Super simple example, um, but obviously we that's what we include in the um In the libraries are simpler examples and folks have been submitting their own examples to the macro pad library and if you um write something up that uses the macro pad library and it's Different from the examples we have um Please feel free to submit a pr and we can help you with it in terms of how to Work the pr. Um, I just had uh to explain some of the um process to someone who submitted one of the examples and they've Worked through it and it's been good. So it's the more examples the better. Um Editing the current examples not as great only because they're in a guide and The guide is written to basically just explain the simple The simplest version of each of those features Um, but if you write something up and it's and it's something you think that others might Benefit from feel free to pr it and we'll take a look at it and see if it makes sense to add To the library Um Foamy guy says paint your dragon's game has inspired me to explore more possible games for the macro pad the first one I think i'm going to make is a kind of game like simon where it lights up the keys and sequences And you have to try and remember and press those keys I'm excited to see what other folks can come up with with that hardware Yeah, for sure um And actually foamy guy also submitted one of the examples which was an led animations example. Uh, just to show how to use um the led animations um someone asks on Uh one of the streams anyway. Um, can fidget mode be used on other boards like the trial list? Absolutely. It's It's a very very simple code um All I do is I wrap the entire hid section under an if And then you have some button or you choose you choose one of the buttons to enable fidget mode and disable fidget mode when you press it Um is how I did it. Although jeff actually suggested an even better way to do it which is have it automatically enable in um 30 seconds because who remembers to turn on fidget mode nobody Um, and then you have to manually turn it off with a button to then use the hid but for sure Um, it could be used on anything. All you have to do is just write an if statement that says if it's enabled Send the hid stuff um Otherwise don't uh, you don't even need an else on that one um, so the trial the the trial list would would absolutely work You just would want to pick a button to use as the button to enable it and disable it and then um Tell the rest of the code to only work when it's not enabled Um, it'll be included in the guide for this Um because that's it's now officially part of every hid project I ever do Um So if you're if you're wondering how it's done keep an eye out for the for the guide um for github Phrases or i'm not really sure what i'm going to title it yet, but something to do like that And um check out the fidget mode section. It's actually called fidget mode in the code as well I I did not obfuscate it in any way so Um Yeah, that's uh, it's real obvious what's doing what Um Hopefully that helps All right, um, so I think cat any expander nailed it. All right, that's what we'll call it um So with that, uh, I'm gonna turn it over I guess to jeff Sure, uh, I'll start by Saying there was another question from youtube that dan answered in the chat But to make sure that anybody who is not on discord gets the question and answer Is there anyone who can tell me on the trinky qt 2040? Which pandora uses as a switch in order to allow circuit python right access to the board's flash memory And dan answers you can use board dot button and I think dan you can expand on this if you need to but You would you would plug it in and then after plugging it in you'd press the boot button So that it can be read by circuit python boot dot py To switch the storage to read write Right and because if you held it as you plugged it in then it would go into the uf2 bootloader Right, so you you might want to put a delay In so that you're willing to wait one second in boot dot py to see whether the switch Is pressed or not because otherwise. Yeah, you'll get into since that button is used for two purposes it's to get into the uf2 bootloader you don't want to You plug it in press it but you want press it as soon as possible and If you if you check it immediately boot up how you'd miss that so you'd want to put in a delay To give you a chance to put the press the button All right, so yeah, what I've been having the most fun with I would say Is making 3d prints around? Uh macro pads and key pads right now. So if you want to bring up my screen share catney, I'll kind of go through a couple of them So first up and most recent for the macro pad catney and I were talking and she said I wish I had a little Bumper that would go around this so it could sit on my desk, but the screws wouldn't scratch anything up so I designed this for flexi plastic and 3d printed it and I have Uploaded the design to thing averse just today. So there's the link for that Next up This was my most complicated project uh with Keyboards it's not with the macro pad. It's with a custom pcb has my name on it and revision b. We'll talk about that in a second But it was to create a calculator Normally there would be a feather and a screen installed here But the uh the one that was actually photographed in the guide. I gave away to a friend This is model b and I just don't quite have it put together But I got to design the printed circuit board Also a little little stand for it that holds it at a comfortable angle to use And then I adapted someone else's keycaps So that I could print them in two colors and get all the nice legends and Then the last part I designed for it was a 3d printed Key switch plate Which um when you solder in it's not super important for stability But if you um You can get the keys mis-rotated when you solder them in I think like seven here is a little bit turned And so when you have a solder in keyboard matrix the plate really helps to To keep the keys from being rotated the key switches As you solder them in so highly recommend they tend to be really easy 3d prints they're only like 0.8 of a millimeter thick and very flat and um, I was just sharing with jp Yesterday on his show There is a website where you can go to to create the layout that you want And then you can even wire your keyboard without a pcb. You just hand wire the whole thing um And so these files are on the guide for the calculator Which is on the Adafruit learn system if you're interested in that And they are some of them designed with free cat and some of them with open s-cad which are two free and open source Modeling 3d modeling packages And then the last print I wanted to show is uh this for holding a feather and the ortho snap apart and you kind of Bolt it all together snake your wiring through so it Is uh trapped under this little bumper thing And then all the keys are really stable and the board doesn't risk flexing and breaking your keys apart And then this um key plate whoops is jp's design So Nice little add-on. I know he shared that on the live broadcast chat. I don't know that it's uploaded anywhere Uh, yeah, so that's what I've been 3d printing And I also Yeah, I was going to talk about the process of making my printed circuit board a little bit So the Basic key matrix is pretty simple You you have a key switch and then you have a diode which Uh allows each key to be recognized individually And then it's divided into rows and columns and you have One connection from the micro controller to each row and column you can kind of see them here And then uh these I think these that went on the back are the Columns and these on the front are the rows And as I designed this I made one mistake which was I needed to use an i-squared c display So I should have left the i-squared c pins free But I was using key cad free and open source software with a feather Footprint and it didn't label sda and scl if I'd seen it say scl I would have not used that pin, but instead it just said I don't know d3 or something And so I used it leading to The need to fix it manually And the revision b board Which fixes it no no extra wires needed But these were made on digi key with the dk red service And these were made with Oshpark and they're really similar physically Some of the differences I noticed were The oshpark boards you have to sand away the little connections that connect the board to the panel Whereas the ones from digi key came already cleaned up. So that was nice um, and then These holes should not be uh, don't have any electrical connections, but digi key put copper up the holes Whereas oshpark did not that's a little hard to see but Uh Take my word for it. See these don't look metallic down inside and these ones do Uh, but that doesn't actually make any difference in how it works With oshpark, uh, I could just upload the file the key cad file of the board and with uh Dk, I had to go through the process of creating a gerber. So it's just a few extra steps but both of the Of the board houses worked pretty well and the boards came when they said they were going to come and Yeah, it was a fun little project um So I had wanted to show an n key rollover demo, but I think I erased that from the board that it was on so That is Mostly what I had to talk about today. Can you explain n key rollover? Can I explain n key rollover? Sure. So um On your on your keypad Especially if you're playing video games You'll find that you want to press several keys at once on purpose If you're using a computer as a typewriter not so much, you know You press a and then you press s and then you press d But when you're going around in your video game and you're changing weapons and going forward and ducking and all those things You want to press a bunch at once so The ability to handle those multiple presses is called rollover and I assume there's a historical Explanation for that that probably has to do with mechanical linkages in old typewriters um But anyway, when you have say six key rollover, which is very common on usb devices That means you can press any six keys, which are not modifier keys But if you press the seventh it might not register or it won't register properly um and when you create uh When you have n key rollover that means that any number of them So like up to 30 all 30 on this keyboard you could press it once and the operating system Would be able to see that um, and so when dan enhanced usb hid in version seven he made it so that you can Select your own usb hid descriptor And you can send the computer a different descriptor which allows Any of the keys to be pressed fully independently of the others instead of being limited to a list of six keys That are pressed by number, which is kind of the default way To do it and so the the way you do this is detailed on a page on the eight fruit learn system within dan hogart's guide um, although I wrote that particular page and yeah, so particularly if you if you want to do some video gaming, um with your keyboard You might be interested in n key rollover if you wanted to do things like Treat it as a musical keyboard, but you'd use midi for that The other thing that people use it for is cording keyboards So there are quote-unquote braille keyboards and there are is it stenography keyboards Where you where you press a combination of keys and then the computer interprets that into Like a word or a symbol together, but These work with like just to say eight or ten different keys one per per finger that you press in different combinations And so that's what I know about n key rollover. All right Great. Well, um, let's uh, see what dan's been up to I just put a link to your page Um, jiff, thank you. The whole guide is good if you want to learn more about that stuff Yeah, you could say n key rollover is like all key all key rollover all the possible keys That makes it a little clearer like what n means um so I'm going to talk about um How some of this keyboard stuff works at a lower level Let me go back to my outline. So I don't forget to say something um So one thing that is new in circuit python seven, which is still an alpha and which should be in beta soon and then uh, you know relative to soon after that would be um Final is that There's a new module called keypad and what keypad does is that it has a variety of ways of scanning sets of keys or buttons or even pins because The microcontroller doesn't know that there's between just plain old pin transitions and that there are keys attached And so keypad there was a there was a previous module called gamepad which um ratamere uh worked on For simple game computers, but it was kind of limited. It only did eight up to eight buttons at a time And so keypad is more general than that and what it does is it works in the background and scans a bunch of pins and Generates events that tell you oh this key went down this key went up This key was pressed And they're in order so you can see like oh press press release release or press release press release whatever and it identifies which key got pressed So keypads uh keypad module um Maybe somebody uh, let me let me paste um A learning guide about this in the chat Uh, it can scan different kinds of keys Uh, if you look at Um I'll put it here the macro pad Uh, there were enough uh pins available on the rp20 40 microcontroller so that each of these Keys has its own pin And so there's one key per pin And that's really easy. Okay Um, but when you get to something like say the snap apart keyboard here, which has 30 pins or your own typing keyboard Which has you know more than a hundred Or you know between 60 and 100 well very few microcontrollers have that many pins and it would be kind of a waste to Spend so many pins and have the circuitry for all that so another thing that's a thing that's commonly done is called key matrix and Jeff has already talked about that where You have lines you have one you have one You have one uh pin One pin is connected to each row and one pin is connected to each column So in this case we've got six and five so you only need 11 pins instead of 30 pins And then you check to see whether There's a complete electrical circuit between a particular row pin and a particular column pin And because they're shared then you can get into this issue which Jeff talked about where If you press down too many keys um, you're going to get false presses for instance here is a um a little telephone keyboard and It turns out it doesn't have these diodes in it to help you to prevent false presses. So if you press say the one two four and five keys Or the two four and five keys then it will falsely tell you also that the one key is also pressed And that's because it doesn't have these diodes that prevent that and that's explained in the guide if you want to take a look at that so The keypad module has first this one key per pin and there's a there's a class called keys It has a class called key matrix for these real column kinds of things and finally it has Something called shift register keys, which is another way of scanning keys is to take an external shift register And connect the two a bunch of pins and then clock the values of those pins in By clocking the shift register. So you're reading all the pins serially. So you only need a few pins on the Microcontroller, but you could have as many pins as you could chain these shift registers together and you could read as many as you want and I don't think there are any typing keyboards that run that way, but there might be Uh, and you could have a shift register for the rows and the shift register for the columns For instance, if you wanted and you wouldn't use it very many But most most of these days most microcontrollers have enough pins. So you don't need to do that So anyway, there's this other thing called shift register keys and um Instead of demonstrating we've already demonstrated we already seen a bunch of demos of the macro pad and so forth And so the macro pad library uses the keypad library underneath And I think true also it's also true. Jeff that you're using the keypad library on the calculator thing that you built and Another thing which i'm not having shown at all, but music keyboards, you know, like piano style keyboards or something like that They also usually use some kind of matrix some kind of row and column thing though Which are the rows and which are the columns is not obvious because a piano keyboard looks linear, but for instance, there might be A row for each octave and then the columns might be each of the 12 Keys in the octave for instance So you will find this business of key matrix in a lot of different kinds of input devices And what I was going to show you today is um, this is a A nintendo snas controller. This is actually just a clone Of one But it works internally and it's I think they're like 15 or 20 years old It has a couple of shift registers inside and the pins on this Connected the shift register and allow you to clock the shift register So it doesn't need a connector. It has like 16 buttons or something But it only has a connector that has eight pins and in fact several of them are not used at least for the ordinary controller So can we read using the keymaker using the the shift register keys? Class in keypad we can read this snes controller So I made a demo and we'll see if whether it works or not Because I had I had some problems powering it up and down But what I've got here is A an adafruit cricket board which can runs connect to servos and I've got a feather m4 on that And it's running. Uh, very is running circuit python 7 with this keypad Module in it and now let me go over and start up this program Let's see. Let's see. Here we go So now I've got what I've got here is this is one of these Servo mounts it has it's a platform and it can tilt this way based on a servo. It can also Rotate based on a servo So it can go left right and up and down and I'll also put another Uh servo on top of this that just spins around so It should be that if I can press I don't know if you can see this Because the lighting isn't that good. Let me turn on turn on some more light here Obviously, we're very well prepared Anyway, you can see this thing going back and forth and I'm what I'm doing is I'm pressing The up and down buttons on this game controller and it's moving up and down or I can turn it this way I can make it rotate this way or that way Let's make it go back up again And then I've got for this servo that I taped on the top here. I can make it spin around Um Let's get some better light there By pressing the a and the b buttons so I'm just In if I were if I had had the camera set up I would have Had some kind of tethered robot and have a drive around and use this thing Or maybe do the whole thing with bluetooth But anyway, read the button states by using the keypad class that does shift register keys and using this game controller So you can use these the keypad thing for a lot of different applications. It's not just Typing keys. It's not just your cherry mx switches. It could be the buttons on a cpx on a circuit playground express or it could be Anything that has buttons or you could even use it to monitor some pins that you're like That are connected to some things that go up and down. They don't have to be real keys So Please feel free to ask more questions about this And uh, as I said, I pointed to the learn guides in the live broadcast chat in discord And you're welcome to take a look at that and try these things out Okay, did did you want to say anything about debounce? Oh, okay. Sure. That's another interesting thing. So keys Uh key switches mechanical key switches bounce when you press them down They make contact and then the contact comes back up again and it goes down again So it might do this a little bit until it settles down And when you release it There might even be a little bounce when you're releasing but it usually tends to be when you're going down It does this A little stutter and you can see that if you look at it on this little scope and it usually takes between A couple of milliseconds to like 10 to 20 or even 50 milliseconds depending on the kind of switch that it is Settle down. So this keypad module runs in the background and it Waits a certain amount of time Before it decides that a key is really pressed. So won't you won't get false up and down events And the default is 20 milliseconds, which is fine And it's really that's pretty typical for say a typing keyboard or something like that You can make it shorter or longer if you want depending on the quality of your keys, but um It's all done automatically. So you don't have to do the debouncing yourself We used to have to add debouncing code and we have a debouncer class uh for reading plain old pins That are that are connected to buttons and it's a nuisance to do that in your program But keypad will take care of that for you. So you don't have to worry about debouncing if you use the keypad module Yeah, which is One of the great things about using it in the macro pad library Um, you can very easily track the press and release and do something different on each of those things without a bunch of different code It's just dot pressed and dot released And then the code you want to run Yeah And talking about having to add code for debouncing. That's why there's a separate instance of the encoder switch in the macro pad library that is debounced because um You can't Like you wanted to be able to just read the value if it's true if it's not so that you could press and hold it But also have a debounced version of it. So there's there's a bunch of extra code in the library A lot of bunch, but there's a bit of extra code in the library. Um, that happens in the background that handles debouncing that switch um That uh, if we'd been able to use keypad for it wouldn't have been necessary Well, we can use keypad for it. I was thinking that we could actually use keypad for it Did we think did we figure that out because I thought that we couldn't figure out how to do like dot true or um Dot value being true or right? It's right. It's harder to know if you just want to know statically whether it's up or down But we could make it an event Instead but that would change the semantics of the library. So we may not want to do that Yeah, that was I thought yeah, we just we tried it. Yeah, we gave it a try because um The first code that phil wrote for the macro pad had it as an ex had it as a phantom key um, it was the 13th key And we had to uh, we had to re redo that whole section To work with the macro pad library because it's not a 13th key. It's a separate button I was thinking that was making it a 13th key. Yeah. Yeah um So I have something I showed off previously um But wanted to show off again because it's a lot of fun. Um is a uh work in progress for led animations and really this It was this was requested Months ago by jp before we were even doing keyboard stuff because of the fact that it's a standard animation on most keyboards Um, and then we got into keyboard stuff and so I thought oh, we should finally do this Um, this is very work in progress. Um, there's no customization for it. It's all it's all mostly hard coded at the moment. Um But basically it's a it's a burst thing where you can set a different center for the burst based on the key you press So right now It just changes when you press it. Um, it doesn't do a thing where it clears as it goes that sort of stuff There's a lot of customizations. We want to add to it. Um But this was a proof of concept and it was really hard to write it On the macro pad, which is what we started with because it's very small relatively speaking so to try and troubleshoot or um Write something that is showing this burst on a three by four keypad um Was a bit of a pain and uh, I didn't have the neo key ortho snap apart yet Um, so as soon as I got it was the first thing I did was dump this animation on it and see whether or not it worked And I had to hard code some extra stuff It would actually get part way over here and then leave like one row or one. Um column rather, uh turned off Um, which is like there's like a length equals something. So I just changed that and like I said, it's all it's all very hard coded at the moment um But the goal is to be able to change the speed To be able to have it work is like a single ripple um Where it turns off the center as it goes um and another thing that I noticed and took a minute to figure out was This burst is very square And on my actual keyboard it looks round And it didn't click initially that this is an ortho linear keyboard The ortho snap apart's where the ortho comes from ortho linear means that it is straight up and down and most typing keyboards are um Not linear Or not ortho linear um The the keys are offset I there's no way I'm able to lift my keyboard up high enough to be able to see it on the screen, but um Yes Jeff Jeff is holding one up that is that is not ortho linear And so it looks rounded because the keys are on angles Um, and I thought because I thought what are we doing wrong? This animation doesn't look right Um, it's not as smooth and it's not as round and that's because it's on ortho linear keyboard So, um, I have another one of these that I want to wire up So that I can actually have it on two um In theory I could wire up four of them and make a big one, but um, I don't think they're in stock at the moment So I think I can order more of them yet. Um But I want to do it on a bigger keyboard um and see whether or not all of our hard coded stuff still works and um See what I can do with this so this is uh This is going to be the latest um Latest animation once I actually get it added in Um, it's probably going to be a while, but uh, it's in progress. It's there. We're working on it. Um So yeah, and this is the actual wiring Just to give you an idea it does take a number of pins um because every row needs one And every column needs one Todd figured out that the maximum that the rp2040 can handle is an 11 by 11 Which is 22 pins And um that leaves one pin because there's 23 gpio apparently available on the rp2040 and I don't think it's available on all rp2040 boards But the actual chip itself can support that much and so you can do an 11 by 11 grid and still have one left for the neopixels um that is a A tidbit I want to add to the uh, the neokey ortho snap apart guide. Um, just as an example of What uh what you can do? um I think the itsy bitsy would handle it. I I didn't count the feather Uh yet, so I don't know how many the feather can handle but remember the the pins that are labeled For i-squared c and s spi and so on are still digital pins You can still use them For other things as long as you don't have plans to do any spy or i-squared c that is um and uh yeah So you can make big old 11 by 11 grid if you wanted to this is five by six for comparison 11 by 11 would not fit on the screen I would have to lift the camera up pretty far So all you need to do is manage to get five of those sheets and that would be just about the right number. Yeah So yeah, I need to find three more and The wiring I think would be a little bit a little bit tricky. Um Not entirely. It's just you have to actually wire the two boards together on the right pins um To connect the rows and connect the columns and connect the leds That was another thing actually with this the leds are um a zigzag on this one And if you snap it apart there is zigzag on whatever snapped apart version you have um And so This is much easier to map Then the rotation was because you can just do a simple transform that the odd rows Are flipped and then it just knows And then the animation library already has that I think yes We we added this just because we kind of wrote a lot of those things for the wall that I have where in my other office That's an led wall and it's zigzag which a lot of You know if you mounted leds chances are at strips that you've connected And those are often going to be in a zigzag. So we basically it's just alternating equals true On setup and then boom it's done. So initially when I started this animation on this grid it was Doing weird things. Um, and then I remembered it's alternating versus the macro pad, which is not alternating. So um So yeah, so that's that's something the led animation library handles already Um is alternating uh grids. So if you ever Uh are setting up one Just take a look at that the led animation library is also an excellent companion. It's pretty much anything that has leds um because it does a lot of setup for you and um handles different orientations and handles um Grids that are actually strips things like that So you don't have to Do the extra math because all of the examples that have led stuff for the neokey ortho Um have that extra little math in them except this one obviously because the led animation library handles it But all the basic examples have a little bit of have a little helper function with some math in them to reorient the the grid back to a standard strip so Anyway, I was really excited about that animation because we uh, we weren't really sure how we were going to do it. We have a um We have one running on the on the wall. That is um, it picks a random point And then ripples a random amount out from it But that is not you pressing a key and choosing the point. That's just a grid on the wall that doesn't have inputs um, so transferring That concept to being able to select The start point for the ripple or the burst or whatever you want to call it um Was a totally different situation um So, yeah Uh, I didn't get out anything else fun to show off. Um Well, I could show some actual python code. Uh, it looks like we have some questions All right, let's do questions and then let's do python code All right, my interest is with raspberry pi projects Uh, how would an rp2040 project be a good way to get started with circuit python? And who is that from that is a question from uh, youtube. Okay um so Go ahead. I was going to say um So the art so the any any microcontroller Um, I shouldn't say any A lot of the microcontrollers we have available are are good places to start the rp2040 is an excellent choice um it It handles like I We we we take our libraries and we make them smaller to put on smaller boards um for lack of a detailed explanation um and You you usually cannot so there's there's like a you know the python version And then there's this like compressed version that we often suggest folks use And for example the macro pad that I have set up over here Has the python version of every library on it right now, which means that they're all big And it's fine. I haven't run into any problems. Um So the rp2040 is a great place to start because you won't run into memory issues with Any kind of project that you want to do um And it works and the key is that it works with circuit python So essentially any one of our projects um other than the The pins might be named different Um, any one of our projects is will work You can you can get started with anything. So if you go to learn dot a fruit dot com And you take a look at you know, I don't know. Maybe you're into leds Um, you look up led projects or something like that and and you see when you like, um, you can do it without rp2040 It's just you may need to if you're using a feather an rp2040 feather Um, the pinouts will be almost identical to any feather example Um, same with the itzy bitzy. There's uh be aware that the There's only four analog pins available on the rp2040 and so The rp2040 feather instead of having a zero through a five Has a zero through a three and then two digital pins. That's the only difference um But the they're all on this labeled on the board. So you you don't you don't worry about being confused. Um But picking any pick a project that interests you Not so much based on it being an rp2040 project, but based on What are you adding to it? um Find the adding to it bit that interests you And then chances are you'll find something on learn.aidafruit.com That walks you through how to do that and um, we're always available on discord. There's a help with circuit python channel so if you can't quite translate in your brain how the You know the the the feather m4 pinout on the example, which is often what we use Um, how that pinout matches the board you have if that if that's like a little confusing for you Like we're always available to help so that's um And and yeah, uh, mr. Certainly had an excellent response Which is it'd be a great starting point though. It'll need some soldering skills for a solder free experience You can look at the aida fruit circuit playground blue fruit or the aida fruit clue boards um That's absolutely valid if you are not comfortable with soldering Um either this will be a new learning experience for you Which we're also available to help with there are tons of videos um, or you might want to look at a board that doesn't require soldering so that You can just get started learning and not have to worry about learning python learning circuit python And not have to worry about learning soldering on the way Totally wherever you're at is what determines what the best option there would be um for you I don't know if anybody else has anything to add to that No, I think that's great. I think the emphasis that circuit python runs on a lot of boards and it runs the same Works the same on most of them. They have some minor differences, but you can Usually do a project on anything so Often can so don't worry about it. If you're if you try to use one of their the basic boards yeah, um Next was a question slash suggestion about the Animation that I was running, which couldn't you also soften or smooth it by having the leading edge be a point two five brightness for sure, um, there's a lot of there's a lot of uh Things that we can do Uh to smooth out that animation like I said, it was very much the prototype. This was this was the first thing that we got working and um We haven't haven't just haven't managed to get back to it since we had a long weekend Which we haven't had since that point. Um, so we took our long weekend and spent it writing an animation And Uh, so yeah, that was from uh, kelly stratton on youtube that suggestion Um And then um, I forgot I was ham's labs had asked Uh, what can you get access to the swd pins on the macro pad those pins are for doing? Uh, low level debugging And the answer is there are no pads on the macro pad that connect to the swd pins because The rp20 40 comes with a burrington bootloader. We don't have to Use the swd pins at the factory to burn the bootloader And so there were no pads left On the macro pad for that and if you really want to get access to them You'd have to solder tiny little wires to the pins And I ran into that myself I was kind of interested in doing some debugging on the macro pad at a low level And so I might ask that if the board has ever revised that if there's a spot for them A couple of pads for those are created But sorry, they aren't available now without excellent soldering skills Yeah, for sure. Um See we had a question on facebook apparently About what's the best microcontroller to use for led spinning led projects where an accelerometer could be used They wow that's very specific. Um 30 pixels three strips Of 10 and wi-fi and bluetooth. I think that narrows it down quite quickly. Um or wi-fi or bluetooth rather Never mind that what doesn't quite narrow it down as bad as I thought I'm like wi-fi and bluetooth like That's quick. Um There's a there's a guide Available on learn.adoford.com. That is basic. I think can't remember the exact title But it's which board which circuit python board is is right for me um Take a look at that because it has separated out wi-fi and bluetooth boards if I remember correctly and That will tell you um what what other features those boards have For what you're talking about doing you definitely want to have a um samd 51 or better. So an nrf 52 8 40 would work um the esp 32 s2 would work um or the samd 51 with a with with some kind of wi-fi um Board attached to it. Um because of the uh project you're talking about doing you just you want a beefier thing So don't go with the small length the samd 21. Don't use that um, that's my suggestion there so I was going to maybe suggest the feather sense or the blue fruit uh playground Because those are both going to have a bluetooth microcontroller Um, and they're going to have an accelerometer. I think both of them Yeah, and then you can hook up your neopixel strip. So that's a way to have just one board Um, and you don't need to like have a separate semi qt sensor That would also work Those are both excellent suggestions just off the top of my head But yeah, I also put the link to the choose your circuit python board Um in the discord chat, but I don't know that that will make it over to facebook. So right um I don't think it will either. Um Is it possible to have multiple circuit python boards interconnected and sharing code? You'd have to put the code separately onto each board, but you can sure connect digital pins Where one of them is going to treat it as an output and the other as an input Or you could use uart or you could use i2c and i2c peripheral Um on the two boards to communicate. So there are definitely ways I don't know that we have a lot of guides about that particular topic. I don't think we do We've had a few questions on it, but I think not enough to warrant Writing up a guide yet. Um, but it is doable Yeah, at some point. I think somebody will do a like a split keyboard and maybe that will figure in that project Um Mario who asked the question about the microcontroller that would work for their project said thank you so much They've been looking at the feather sense. So Uh excellent suggestion Jeff Um Keep the yes to an earlier question here Which is kind of how do you go from a new board or product to that first project you used to showcase it? um so Where was that question that's that's in uh, that's 203 p.m um My broadcast show but I was going to say that I think it's the other way around is that for project boards The project is usually conceived of or multiple projects Like for instance the mag tag was like well, we'd like to have something that lasts for a long time And we can use an e-ink display for that and it could sit on your refrigerator and it could Find out the weather and post it and so forth. And so we usually Uh, we'll more infill other people who usually come up with these ideas and they would prototype it um using existing parts and then So to get some proof of concepts of those things and then design a board around that particular those particular That particular class of use cases Yeah, for sure. Um, and the prototypes are always pretty gnarly um Because they you know, you want think think about prototyping the circuit playground blueprint like there was already the circuit playground but Prototyping that you have like seven or eight different features all of which you would have plugged in separately Initially just to proof of concept the fact that you could have all these things in one um So some of those prototypes are Are pretty crazy looking um but I think that is yeah, it's sort of is the other way around like dan said um And they'll often come to us with ideas and say hey, you know, we were thinking about this like what else Would make sense in it and we'll of course toss something else into the mix um Yeah, so uh Keith says that only that makes the build process makes more sense um And when i'm trying to think of what to do with the board assuming that there are some learn guides already out there I'll look at the learn guides and say what can I do to tweak this so it'll really become my project and not the project on You know just the project from learn so picking something where where I see a possibility to improve it or That I want to just try out And then I know yeah, maybe I'll pick that up and give it a try That was actually I ran into that with the macro pad project um Lady aida suggested that I do a hotkey project and I Couldn't think of one that I would use um, and so that's when I ended up deciding to do the one with the toxic spander concept Was after some serious thinking a couple weeks worth Of uh saying I'm I'm never going to remember to press it to you know do command c Um, so what would I do? Um, I don't use Any applications that have a lot of Things that I do like philby had one for like illustrator and and photoshop and so on and I I don't use a lot of shortcuts in those apps So like it doesn't occur to me to have like a whole keypad set for them and so on and so forth so To try and come up with something that was enough different that I warranted Its own guide um is something that I also went through with with my macro pad project um My very first project Started with ordering a circuit playground express not knowing what it was thinking it could connect it to a raspberry pi uh like as a sensor um And quickly realizing that's not what it was But not really understanding what to do with it um Let it sit around for two weeks before finally picking it up and then stumbling into circuit python and um Then it me figuring out what to do with that board at that point for that project was more iterating on learning how to do different stuff with it And then I was like oh I've now learned these five things How can I put these five things together to make something and I made a tone piano? Um that use fruit for capacitive touch um You know and it was just those were the you know that lights up as well and those were the things that I had learned how to do um So that was how I went through it first um Someone else is is it possible to add an airlift co-processor to the macro pad? Um, I don't have an answer to that The answer is not using spi because there aren't enough pins Okay available unless you wanted to sacrifice some of the buttons Is it it has a stemma connector and you can talk i2c or urd over that so you couldn't talk We have a library that Does urd to an esp32 co-processor, but it hasn't been that reliable so Yeah, sorry. There isn't an easy way. Yeah to do that. Yeah But you could take like the the break apart It's an app apart keyboard and uh add And connect that up to anything. Yeah, this one happens to have a feather s2 on it because it was Waiting at the top of the list So yeah, it's a wi-fi keyboard if I needed that. Yeah, which it turns out I didn't but you might have another Application in mind that does. Yeah, absolutely and um extra starboard asks About having a feather wing with a particular some particular things on it and there's a product suggestions page on or in the contact form I think on the website. So feel free to submit product suggestions. They do Absolutely Or you know the designs of eta fruits are led feather wing and i2s amplifiers are going to be out there So you can bash them together in ego or key cad Both of which are free to use You'll just maybe have a little bit of an interesting time getting the components right now Yeah for sure So king of north on discourse has for the macro pad. I created a couple pages for the game called elite dangerous A few of the shortcuts required using a sequence of key presses including slight pauses between the keys I use the guides from catney and phil b to create the coding needed. Thanks for the guides And that's exactly what we're going for We want you to be able to take this and just do what You want to do with it and not struggle with that um So i'm really that's that's really good to hear. Um, so jeff you are going to show off some python code Yeah, do you mind bringing up my screen share there? So, um This code actually is to run on the the ortho keypad here And it creates basically the left half of a standard keyboard And this is the whole circuit python program. It's 29 lines long And first of all, I'm just tickled by how simple it becomes when you have the key matrix Module when you have ater fruit hid All of these things. So I'll just kind of walk through it a few lines at a time. Okay um With python, of course, you always import the things that you use that come from other files or built-in modules or so forth And then uh, I just delineate which are the row and column pins which Was kind of kind of painstaking to figure out how did I wire it and then how is that called in the particular build for the feather s2 But you know once you get that worked out It's done and then there's what is the mapping of the keyboard itself So this is specifying that the first key here is escape and then one two three four five You come down to the second row qwer ty and so forth for all the five rows and then you create the key matrix itself and the usb keyboard device And then you head into your forever loop You get the next event That event has a key number From which you can look up the code for that key And then depending whether it's pressed or not you send a usb event to press or release the keyboard You load these 29 lines on your circuit python board And it is a keyboard that your computer recognizes and it works just like a keyboard you know the the shift keys and control keys and It's amazing it all just works and It's code that you can explain and you start to understand in just a couple of minutes So thanks to everyone who made that possible. It's amazing Yeah No, it is Uh, and I wanted to point out um Todd said that is his first sighting of walrus operator in circuit python code Yeah, so this little guy here People call it the walrus. I guess those are two tusks um, so it is a way to update a variable But also do a check on it like a while loop or an if loop and it is a recent addition to the python language And we've also gained the ability to use it in circuit python 7 Uh, although because of some deliberate technical choices we made we Can't include it in examples in the ate fruit learn system, which is interesting I did not know that. Yeah Because we check them with a very old version of pilant that version doesn't know about walrus operator And so until we upgrade we can't start using it in learn Wow, I guess we need That actually just got me today because I had written it in uh some code for my next upcoming guide, which is not keyboard related Um, and yeah, I kicked a ride out. It said I can't even make sense of this code I'm not going to bother telling you what's wrong But those are the best for me. We'll be able to use it in learn Those are my favorite warnings Um, and thank you Dave for recognizing my nicely formatted code table. Um, it it uh It would be illegible if you squished it together like Or put it all on separate lines like black would like to do so I was gonna say do I wrote this one to look just like I wanted it Do not run black on your code if you have formatted or disable you can disable black Yeah, how do you do that? It's No, it's not like that It's it's something like no qa. I don't remember but it's not no qa, but it's something similar like Don't no format or something. Um, it's in the guide actually How to do it um, and you can disable it for sections. Um, so do be aware if you are uh using black to format your code And you want to have special formatted uh Tables you you want to make sure that it Um, isn't run. Um, so I guess as long as we're looking at code um let me uh Let me pull up some of the macro pad library code And Show you how simple that looks Um, feel free to chat amongst yourselves while I find it. All right. Naradax says I think I would prefer having an iterator to do For key in keys dot events, which I don't think works now Yeah, I bet there there would be a simple function that you could kind of introduce in between to make it iterable like that um But I considered that but it it it removed it it eliminates some other possible use cases So I didn't do that Particular it's it's an iterator that runs forever because and also it returns none when there isn't an event So you don't want it to block necessarily So, um, there are a variety of reasons not to make it an iterator Yeah, I I think you could do it. I I could show some untesty untested code if I bring my screen share backup Oh, um Depends how close you are to ready. Yeah, you could really make it an iterator I just we didn't want to make that to be the fundamental right so we could say Events of keys And it'll say That will be just be this So obviously it's untested but What this will do is as long as there are events that will go through this loop and then say you add something else here like update the leds Then it would it would go through each event And then it would go through the led updating process and then it would repeat All right, so let's take a look at some macro pad examples Um, this is the simplest version Of it. Um, I can't give you I don't know. What is it 11 lines? Um Small math is difficult So you this one uses time, um, but basically you To use the macro pad library You import uh from a different macro pad import macro pad You create an instance of the macro pad library And from there you can use any of the features Of the library This simple thing prints out The keys the key number pressed whether or the relative position of the rotary encoder And whether the encoder switch is pressed and it prints that to the serial console This is a very simple light just is your macro pad working and do you have the library set up properly? So we check for the key event which this is a common Thing to pretty much all keypad code you need to get the events Um, and then it says if there is an event and it has been pressed Then print the number and then uh beyond that, uh print the encoder position And whether the encoder switch is pressed and there's a delay just to keep it readable um So that's that's a very simple thing. Um to show that information on the display You have the same import structure um And then you create a display text instance where you give it a title Or you can leave the title off and just have the first line of text to be at the top Um, and you create a variable for that Then once again you're checking for keys Except this time, uh, we are updating a line of text to display the key pressed And this shows up on the display um as a line of text That updates when the status Updates um Someone's asking where is the link of this project? Um, if somebody could link the macro pad library examples That would be excellent. Um, this is actually in the macro pad library um I can show I can find the right window here um So So this code, um, I think I have to stop sharing and then reshare the other window Looks like Can't find the other window That's special um Okay, I can't show you because I can't find the camera for some reason. Um So it There's images in the guide. Um, basically it displays the text um It displays the text, uh And Nicely in um Nicely in in lines. Um, it's easy to update Uh, this was an example of using the rotation option Um, so if you want to show it rotated You just set it up with rotation here and it accepts 90 degrees 180 degrees and 270 degrees also except zero defaults to zero those so there's really no point And uh Then Um notice that I have the same title, but I added a new line because it's it's too long to fit on the display when the display is 90 degrees so, um Things like that to display an image Uh, this is all there is to that So, uh, circuit python compatible bitmap. We do have a guide on creating those. There's a couple tweaky things Um, not all bitmaps will work and you want it to be the right size um This would display the blinker dot bmp image um And uh, this is just so that it it displays it and then and then does its thing. Um Um, some of these get a little more, uh, complicated. Um, this is the tone keypad um Where uh, I created a list of tones that um, there's 12 of them obviously one for each key and um It lights up each key a different color of the rainbow And then this is how you start the tone when the key is pressed and then you stop the tone when the key is released um for Your own knowledge if you use start tone always use stop tone because Uh, it doesn't actually stop playing the tone without stop tone. Um play tone. You can specify a duration um But start tone needs stop tone their friends um This is an example For using keyboard and mouse um I did some Some stuff here where the just the first because there's there's four different things basically you can do with um the hid keyboard stuff And that is send um a single key send multiple keys send a string or um a consumer control code I'll explain what this all means in a second here. Um, the single key easy enough um, you just send it the Couple of keys together you you you press them and then release them. Um, because it needs to Use one as a modifier key um using keyboard layout dot right allows you to send full strings, which is what the um github text expander project will use and then things like volume mute uh play pause Are what are called consumer control codes even on regular keyboards. Um dan explain this to me They are not normal Key presses. It's it's a different concept And so our hid library includes various consumer control codes as well But you have to use consumer control dot send instead of keyboard because they're a whole separate thing and then um I have it set so that when the The encoder switch is pressed It sends a right mouse button click And then when the uh when it is rotated Um, it moves the mouse a little bit to the left and it's rotated the other way it moves it to the right and this is um by itself not that useful of an example Um, but what it does is it demonstrates all of the hid and mouse stuff that you can do Um with the macropad. So you can use it. Um to send hid stuff you can use it uh to send mouse clicks and so on. Um And um That was what that was what this was an example was basically written up for and then here is a simple example using the led animation library And uh you import the led and what you need from the led animation library and then um Set up the library set up the animation and animate and that's all there is to using the animation library with it. Um But that's that's pretty much all there is to using the macropad library. It's it's very simple. Um, and The actual setup that happens here is many lines of code So this takes all of that out of your responsibility Um, and makes it so that you can just get started using your macropad to do fun things So there's my quick overview of the of the macropad library All right, I think we haven't had other than the question. I just answered. I don't think we've had any more questions There was a question about whether you can use uh keypad with blinka and the answer is that melissa made a compatible library That will operate on blinka as well. So you could use those Raspberry by gpio's in a very similar way I I assume that covers the matrix. Does it cover the shift register? As well, do you know dan? Yeah, I think it covers only so it covers all three nice. Yeah It's really pretty much a transcription of the ccode into python so That's exactly what blinka is I I suppose you could also use that to bring keypad back to circuit python 6 if you really needed to for some reason Could well, no it works in the background. So it works in the background. That's true. Yeah um There's also I don't know people have noticed um some of these examples use um rainbow i o which Is uh something we added to circuit python 7 That has the color wheel function in it. So you don't have to add the wheel code to your example anymore if you're using circuit python 7 um You can just import color wheel and then um Where you would normally Have to have fancy color wheel code. You can just use color wheel Um, that also has blinka support, uh, which is the first and only Uh contribution i've ever made to blinka um Was uh doing that which is also what gave me my um Super uh Increased understanding of what blinka was. I actually had didn't really understand Apparently, um because when I went to contribute to it. I didn't have a clue what I was doing Um and melissa explained everything it is basically um All of the all of the stuff that is supported. It is the circuit python stuff, but it's in python. Um, so Couple things we have other questions. Um, is there an automated way for including libraries? Um, I think that's what circuit does um, so For the you used to have to hunt them out. Um We have a tool called circuit that I think can I think maybe it only updates I don't think it finds initially, but if you go to any one of the projects on the learn system And you go to the code and there's a download project bundle button It will download all the libraries you need for that project. So what I've even done is find one that is basically what you're trying to do And download that bundle put all the libraries on your board and then do the thing you were going to do And then you've already got all the libraries um But otherwise you can download the bundle from circuit python.org slash libraries and then just copy the libraries out that you need Um can be a little tedious, but once you're done, um You just need to make sure that you update them if they get updated Otherwise you're you're set to go. You don't have to copy them over every time And if you set up this program circ up on your desktop computer You can use it to install the libraries or to update them So like say you put your code on your circuit pie drive and it says import error a to fruit hid Not found you just type circ up Install a to fruit underscore hid and it will add that Okay, what's what's missing is it wouldn't wouldn't it be nice? Who would automatically look in code dot pie and figure those things out? So please please add that as a pull request to circ up because it is like so many other things. It's community supported It is very much community supported and thank you to everybody who who contributes to that um so Dan you said works in the background and someone uh wanted to know if you could explain that a little more so um keypad library um the part of the Part of the keypad library that does or the library the module that does that checks the keys to see whether they're up or down it's it's um running In the background as a background task of circuit pie thought and uh it checks So the default is every 20 milliseconds, but you can change that and it will pull the keys and record their states and then add Whether they change from up to down and add those things to the events queue the event queue that uh the keypad object you're using Does and this all happens behind your back Um, and you don't have to initiate it. You don't have to ask it to scan or anything like that It's oh, it's it's happening continuously Um, that's not the kind of thing that you can do in python easily. We don't have threads turned on right now And we also we want it to be as fast as possible So it doesn't uh, it doesn't interfere with other things that are going on other things go on in the background too that you don't see For instance, when you read or write to the circuit pie drive that's going on in the background And you don't see that I mean from from the host computer or when you play audio and then It will continue to play the audio and your program will continue. You don't have to wait for the audio to finish Playing you can go ahead and do something else. That's another kind of thing. It's done in the background So that's what I mean by background tasks excellent and then the final question was any or from the same person is um Any cool use cases you could quickly share anyone known to have used this for access control Uh, not that I'm aware of Doesn't mean you can't um trying to get the Thing I got my my camera to pop back up. Um, it's not focusing very well, but this is what the example looks like The display the simple display text example Shows true when this is pressed It shows the relative position of the rotation and then when the key is pressed It shows you which key is pressed And that is just the simple test simple test Display example So, uh, and um The keypad library or the key the keypad module is written in c. Correct That's right. Yeah. Yeah, there are only very very small amounts of circuit python that are written in assembly It's really quite quite astonishing how little that you have to do And it's never anything I have to do from day to day while working on circuit python even in the core um So aza's built to code says i'm working on access control to my jeffrey's tube any sullenoid lock recommendations I think lady aida showed off a sullenoid um Just the other night on eskin engineer. Didn't we just get one in? Yeah to the shop um I I think it's probably more for fun than for actually securing access to something against, you know A real threat, but um, right when I say I thought I just I thought we We actually just got one in so But yeah, I think that this uh This kind of sullenoid lock would be an interesting choice for You know if you have a if you have a keypad and we need when you put in the right combination of one lock I think it's certainly up to that I'll find find the store link for that and drop it in the chat. Okay We had a question from someone called randall who says, uh, when should I start using circuit python, uh, whenever you're ready um It you know, do you do you have a are you interested in learning python? Are you interested in learning electronics? Uh, do you have a project that you think would use circuit python? These are all um points at which Uh, you could start using it. Um, I Started it when I started learning to program and started learning electronics um other folks already are very familiar with these things, but um, Maybe not familiar with python and want to learn python. Uh in a in a way other than just uh programming Um, oh, uh, when you start using circuit python 7. Yeah, I can't read. Um, so anytime it's it's pretty solid right now There's a few bugs that we're still working out. Obviously. It's still in alpha. We have one api change we want to make um to hid but other than that we're looking for a beta soon and um Then and we we expect that the beta to release candidate to stable. Um, we'll go pretty quickly because it's already very stable um, there are for the example, it's the only thing available for the macro pad and The issue like issues that folks are having are not related to circuit python 7. Um Um So really anytime is is good and unless you are using um something in in production Maybe don't go to an alpha, but um for your own projects like give it a try and if you find bugs, please let us know That's that's the whole point of of our public. Um Uh development phase Um, is there you know a public development is that we want folks to be able to use these things early and often um I use it on everything. Um, but Uh, obviously there's some stuff we have to go back and check on six, but like I every everything that I've got running here Right now is running circuit python 7 and um, I am not running into Issues, so I would say as soon as possible. Um just if you run into bugs file an issue and let us know and uh Uh, let us know how to reproduce it and so on and so forth Yeah, I guess I would add a little bit to that and say, um You need to be willing to encounter a few bugs and be willing to file the bugs So if you are on a shorter timeline for some reason You may want to choose the um stable version or if you just don't feel like Uh Feel like running into those problems. Um There's there's no shame in using the stable version But also it is very easy to go back and forth to put six three back on your board You just pop back into the uf2 bootloader and drag the six three version over and you are back to the more stable version of circuit python so Be be willing to spend a little extra time helping us make seven the best version of circuit python if you try it out um But also know that you can use six three uh as soon as you you see trouble if you do For sure. Um Obviously unless you update Your code to use features that are only available in seven in which case it won't be quite as easy to go back to six But if you are just have a basic project and all you do is change out circuit python You can always go back and forth. That's that's very quick quick process. Yes Um It says how often you go through the old projects you've made that are running around the house and update the versions of the code um, so for myself Um, when I add a new feature or I learn about a new feature that would improve the project I will definitely go do that um, so I have a timekeeping device that I updated to version seven so I could use the new aetherford ticks Uh functionality, which is a millisecond tick timer that never runs into rounding problems or Needs supportive long integers. So that was really good for my use case and I updated my device um my circuit python keyboard I just want that thing to be stable forever. So I wouldn't necessarily go and Um mess it up by doing that and that this is this keyboard is running circuit python with k m k And I've just used it every day for two years and it's great and I wouldn't change it because it's working um For me most of the projects I've got sitting around the house are not doing things So I pretty rarely update them. Um, I would say most Most most projects I update come out of someone have running into an issue And then me saying oh, I've got that set up. Let me go update it and See if I run into the same problem. Um, at which point I can update the code and so on and so forth. I think at that uh loaded um or um We have folks who are building our our projects And they're updating them. Um, so when we run into that situation where um Someone will be on discord and in the show and tell channel saying hey, look I did this I built this thing that you guys did like last year and Um now it's updated code. Uh, I will sometimes snag that and uh And update um and asks have I run my neopixel wall code with the new versions? Uh, no, I don't think I've updated circuit python on that board. Um It's it's a little bit of a pain because I need about Nine feet of usb cable um So the updates, uh Are slow moving to the wall the wall gets updated last um We update, uh You know, we we we test everything on matrices or Or whatever and so that it's easier to deal with instead of having a giant cable dangling across the room um davidji asked about A project that would let you choose between projects to run at boot time And we just added something called setnext code file Which lets you basically you could have a code.py that presents a menu of things and then You could say which one you want to run and then it would choose among several alternative files And then we start itself after saying well next time you start Don't run code.py run this other file run Uh Game.py or run calendar.py or whatever you like Uh, so that's good for doing that kind of menu system stuff Um link in the in discord about that excellent Someone asked uh, are the circuits like circuit python arduino is set up pretty pretty similar if you're referring to the wiring It's identical. Um circuit python, uh Obviously looks and works differently than arduino but um We often use um And in examples, we'll we'll put we'll show a wiring diagram with an arduino And we'll show a wiring diagram with like a feather m4 but um, for example the the Uh guide that I just did for the neokey ortho snap apart is exactly the same wiring diagram for all of it um So The the wiring is the same if that is if that is the question um It's just obviously how you tell the code to look for The hardware is a little different in circuit python obviously than it is in arduino Um, and you would need to know pin names for arduino and pin names for circuit python, which don't always match um And someone pointed out I could hook up a raspberry pi to it and do it remotely. I have considered that And then I just keep forgetting to do it So I agree completely a raspberry pi would make uh the wall being updated remotely Much faster and since all the circuit python libraries run on raspberry pi it would be very simple to Transfer that code thanks to blinka um But I haven't gotten around to it So david was speculating about whether there was a way to power the macro pad externally and there's definitely not a built-in facility for that But it looks like you could pass in regulated 3.3 volts via the stemma connector As a hack But that's based on 10 seconds of looking at the schematic and you may damage your hardware if you try it So let us know how it turns out, but it would definitely need to be Regulated 3.3 volts. You couldn't just connect the battery directly in I mean we don't we tend to add Battery jacks to things that are not high current So, uh, you could certainly just use A usb power pack. That's true a nice flat one or something yeah That would be the general recommendation would be usb power of some sort or Take a sacrificial usb cable and hook up your battery voltage to it because The macro pad would regulate that down to 3.3 volts using the regulator that it already has So then you you know instead of the a connector on the other end of your usb cord it would be a battery You've still got to figure out how to charge it, but uh, so there there are two terrible hacks Um in grave arrest some systems can be updated via wi-fi Do any of your libraries support that and it depends on what you mean by updated, but we are Scott Shawcroft who's also works on sort of python. In fact, he's kind of the head of the team Is working on a bluetooth low energy workflow so that you would be able to program a device Via a ble app that runs on your phone or a tablet or something And have with no wire is be able to edit code on your board and Talk to the ripple and stuff like that. So that's a whole another new way of Controlling things so you don't have to have a host computer that connects via usb that you could You could you could just use bluetooth and that project is in progress And it's beginning to work and we're working on the app side Now also it's just beginning to come to fruition As far as updating the circuit python firmware I haven't used it myself, but i'm aware that a community member added a module called a dual bank And on the esp 32 s2 This would be related to how you would over the air update the circuit python core program itself So you would have to add the part that downloads the new firmware file and feeds it to the dual bank flash function, but Uh I think it works. I think the contributor Would have tested it and seen that it worked. So, um, I'll just drop a link about that in the discord chat That doesn't really deal with updating the circuit python files themselves But of course in boot.py you can switch it to be writable from Circuit python and then within your code.py you could do whatever You wanted you could connect to a website and download fresh py files Um But we don't really have an all-in-one Solution that says here's a workflow you should consider following and here's the code that supports it. It's more. We've got bits and pieces right now so, uh, and again Help fleshing that out and finding a good way to do it. Um, we would love that It's certainly getting close to our hard stop. So probably we should make our apologies and make room for lemor at the The show at 3 p.m. Eastern time Yeah, for sure. Um, i'm sure there will be more questions, but uh, Folks will be around in discord to answer them Um, as we always are um So this has been uh chat with About circuit python with jeff dan and catney Um, thank you all of you for joining us and thanks everyone for participating. Uh, these have been some great questions For sure. Uh, we definitely, um Had a lot more content this year than we did last year. There's three of us. So that makes sense, but um, That was also thanks to everyone who has been participating Uh, so thank you everyone. Um, remember that you can uh join us on discord anytime We are available, uh, 20. Well, we're not personally available 24 7 but the discord is at adafru.it Slash discord you can join us. Um Right now we're all in the live broadcast chat Which is where we are when there are live streams, but you can check out the help with circuit python channel If you have any questions about circuit python Um, or any of the other channels, uh, take a look see what works best for you. Um We folks are uh, most of the folks that are available on that discord are community members that are volunteering their time So ask your questions. Um, but be patient Um with both us and our community um Somebody will be able to help you. Um, it's just folks are around at different times No, and someone's asked whether discord wakes me up at night. It does not Um, but we have folks that are around at night. We've got folks that around all the time Because um, they're from all over the world So night time is not always the same for everybody Um, if you want to learn more about circuit python check out circuit python.org If you are interested in supporting circuit python, um, circuit python is primarily sponsored by adafruit So check out adafruit.com and purchase some hardware um We also have our uh circuit python weekly meeting every monday at 2 p.m It's a little bit of an awkward time for a lot of folks in the eastern time zone But um, it started out as a internal thing and became a community thing So it stayed at the same time, but if you ever want to join us there We talk about what we've been up to what we're what we're doing. Um, what's going on with circuit python Um, and so on and we welcome anybody to that meeting Next up is going to be a board tour with lady aida and phil Um, they will I believe be taking a look at Different boards is what the plan is there. Um different circuit python boards. Um, and we will be around again Like I said for the rest of the day to ask questions answer questions Um as they come up So thank you everyone again for participating. Thank you jeff. Thank you dan Um, thank you to mr. Certainly for gathering the questions from those other Yeah sites And if we missed your question sorry, um, it's not that we didn't like it but um Just went by too fast, but come join us on discord and ask around Yep. All right. Well, thanks everyone and we hope to chat with you again soon Maybe in a year or so. Maybe sooner Later