 All right. Hello everybody. Happy Friday. Made it through another week. I'm a few minutes late here, but we're about ready to get going Let's see who we got in the chat so far. Cgrover, how's it going? And DJ Devon? More trivia game. Yeah, I think yeah, we're gonna play with the trivia thing for a bit. I got a couple of different ideas I'm not sure exactly which way we'll take it But we'll play around with it. Let's see here Beata over in YouTube, how's it going? Let me get my chats Situated here, and then we will get this show on the road. All right, so hello everyone If anybody is new my name is Tim. I go by foamy guy on github and discord. This is the deep dive program We are Looking at stuff inside a circuit python either the circuit python core itself sometimes circuit python libraries Sometimes circuit python projects Which is where we're at today. We're gonna be looking at a project But it is kind of on the cutting edge because it's a pico w project and we're making use of the Wi-Fi Which has only recently gained support So we're testing that out successful Now it's back to green How's it going? Charles if you could see me at this point that they're okay, so yeah, I think we probably cut out for a second there Let me check. Let me check one more place Let's do this We green on this side This one back Yeah, we're back to green on this side as well Hopefully we're back in business. Yep How's it going Paul SK? Happy Friday and to Charles be as well Hopefully we won't Have any further stream or network issues. Let me see here What I'll do is I'll Keep OBS here, but turn off the preview That way I can actually try to keep an eye on the Uptime or whatever not really uptime but upspeed or something Whatever this is Okay How's it going, but city? So let's see. I don't remember exactly where I was that got distracted by the stream cutting out But we are running Python on these tiny computers. We're able to connect it to the computer with a USB It shows up as a thumb drive. You can write your Python code right on that drive and interact with the peripherals that are Connected to the device. So in this case, we have a Wi-Fi chip inside of here we're going to be connecting it to the internet and Fetching some data from an API And then there's also a bunch of pins along the side and we're able to interact with these pins in various ways as well sometimes for just like lights and Speakers, you know on-off switches buttons things like that But also you can connect more complicated things like displays And other sensors and peripherals and stuff. So That's kind of a high-level look at what we are doing against circuit python is the main project You can find more at circuit python.org I'd also encourage you to join us over on the discord All the development takes place out in the open and we collaborate through the discord So if you're interested in getting involved or just seeing what goes into the project head over there and join us The discord in fact, it's the same discord which is on the screen below me there The live broadcast chat is where we're at now. That's the chat that runs during live shows But there's also a circuit python dev and help with circuit python and several other channels inside there So head there and join us if you want to Either, you know get involved or even just hang out in the community or get help with circuit python or anything like that Circuit python is an open-source project, but it is primarily funded by this company Adafruit This is a hardware and software company based out of new york This is their website adafruit.com. So they are paying the folks who work on circuit python full-time They're paying some folks such as myself who work on the project part-time They pay us to write code and guides and documentation and do projects and make videos and do live streams so thank you of course to adafruit and What I will say is thank you to anyone who wants to purchase Hardware from them if you head over to adafruit.com and purchase yourself some fun toys to play with You are helping support the circuit python project by buying stuff from them So thank you for those of you that do that and then jumping into today's Idea, let's see. Let me catch up here. How's it going axel magnus? Submitted some libs to the community bundle including a range slicer Linear quantizer uses hysteresis instead of filters for low latency noise reduction I can't say as though I know exactly what that means. It sounds like some sort of filter Maybe for some kind of input from a sensor. You're kind of filtering out Values you don't care about as much maybe values that aren't actual good reads or something I'm not sure if that's actually what you mean though Also submitted a shadow watcher, which is a gesture detector originally for the Originally designed for the pi portal working on a tarry punk console emulator. Whoa, that's pretty sweet tarry punk console I'm not familiar is a tarry punk. Was that a uh, was that a device? I've heard of a tarry But not specifically a tarry punk. What is that? Let's see Let's see here. So I think uh, how's it going to shippu as well? I think I missed a shippu back a minute ago Uh We get that translated Sensor filter for noisy sensors. Okay. Yeah. So if you have like a PWM sensor or something like that and it gives you, um You know lots of noise lots of up and downs and stuff This will help you kind of narrow in on The readings that are most relevant sounds like so this looks like okay, so it's some kind of synth device a tarry punk console Uh popular circuit that uses two 555s or a 556 for a diy Noisemaker, okay, so my guess then is this is probably how the atari made sounds. Is that the idea here the circuit? Uh, maybe was inside the atari and then you're making one that's just on its own to make sounds with it But uh back in the day, this is maybe what they use to generate sounds in the system I don't know that for a fact, but this is kind of my guess It's on the name tarry punk console, but maybe it's unrelated. I don't know Um So Looking at today's plan what I would like to work on. Uh, I would like to work on this trivia application Um, let me get the camera going here The 121 it's probably gonna crash on me as soon as I load it Yep We'll restart the Second time's the charm. Not sure why but I tend to have to restart that twice Uh, we have pico w freshly soldered With its pins It is very dark and very difficult to see Let's fix that one out of two That's looking better Not so much Are we out there? We have a perfect focus, but that'll do So pico w I have a couple ideas actually. So one of them you may have spied. I also have a display on this device Uh, I think it'd be kind of interesting to try out the display with the pico I don't believe I've ever used a display with any rp20 40 devices That I can think of I don't think I have. Um, which is actually kind of surprising I was thinking about that and I was like, yeah, I don't think I don't believe I have Maybe I did and I'm forgetting one, but um, I do like to play around in display land a lot So I figured maybe it'd be cool if we hook up the display to the pico w We could put trivia questions or we could put score or something on there So that's maybe one idea. Uh, and again, I have a couple ideas here I'm not sure which direction I want to head Directly, so I'll give you my ideas and then I'll kind of figure out where I want to go The other thing I have here is Stem a cable which we could use to connect This you put the chats back here as well get them covered up Uh hysterically useful. Let's see Used with potentiometer to act like a rotary switch, for example, interesting. Okay Hysterically useful Who knew like 40 years later tarry punk is just an awesome combination where it's that's true It's associated with the tarry Oh, not associated. Okay, not associated. So probably was not the thing inside there interesting Uh, so stem a cable we could connect this this has stemma plugins. It's a one by three Neo key device so you can plug in cherry Compatible keys to the top here Um, and this is nice because this has four buttons And our trivia game has multi-choice questions which have Or potential answers So maybe we could make our game where we press the buttons on here to select the answers that we want Maybe that's in conjunction with the display Maybe we go a different way and we don't go with the display the other thing that I was thinking of the kind of third idea I have in mind is Making the trivia into a web application. So in that situation, we would not use this display But what we would do is run a web server on this pico w We would connect to that web server from our browser on the pc or a browser on the phone Um, you know, we would put in the ip address for the pico w We'd load the page and then it would have the trivia game on that page Um, so this device would be hosting the page for us We could then use a client device to load the page see the questions Press the buttons to put the answers in Uh, you know look at our score and all of that stuff So there's there's a couple of ways it could go and it could mix and match right like whether we use the web server or The display io display, uh, either way, you know, maybe we could still make use of the neokey Even if the web page was just output like it outputs the question and it outputs the score And then you use the buttons here still to put your answers in. Um, that might be kind of cool So that's kind of where i'm at is I want to just play around with a couple of those ideas I think i'm gonna start with the web server I think that's a nice place to start Because pico w is brand new raspberry pi pico that has support for wi-fi and the wi-fi support in circuit python is brand new So it'll be good maybe to give it a try out here with the web server, right? That's a relatively complex Uh project as far as circuit python goes. So it might be good Oh, uh, yes, it does help. Uh, you must plug the device in if you would like it to be connected to your computer it is not As magical as that yet, although there is web workflow on some devices which you could use over wi-fi Maybe it's not quite the case but not this one So we need to plug that in And we can go back to here Maybe refresh this Still not wanting to show Uh, let's see here. I had to actually Recycle this one earlier The thing that is tough about the pico is there's no LEDs. There's nothing that tells you if it's on We're currently disconnected Interesting. So let's see here. I did just solder the pins. I haven't had it on since I soldered the pins Is there's some chance I mucked it up get a little light here Trying to see if I have any pins jumped Um, especially like the reset pin or if there's Enable pin, I don't know if these ones have an enable pin See any on that side Any on that side either Hmm, let's try different usb port I actually did have trouble with this device even before I soldered the pins The led is off by default. Oh, there is is there an led on there somewhere Never seen it There we are. Okay, so we switched ports and now it's connected I don't know what that's about, but we're in business now Is the other end plugged into the computer? It's plugged into a hub With a bunch of other stuff Um, yeah, I've got the sparky Uh, it's not a power only cable. Yeah, I'm confident that it's a data cable These cables I've used the particular cable that it is um Came out of a bunch of cell phone boxes I did a project at work at one point where I had the pleasure of opening like three to five hundred cell phone boxes that all came with usb cables and um I'm still using those cables because I kept a handful of them Uh, so we should have this now or if not, okay. Yeah, we should at least be able to reload to get it So, uh, if folks are interested in the trivia aspect of this, I did make a Serial sort of terminal version of the trivia game that runs on this device So the way this one works is you run it on your Pico W is what I tested it on Theoretically it would work on other stuff as well Uh, it does it does use native wi-fi So, you know, you would need to run it on a device with native wi-fi Or else you would need to modify it to work with ESP 32 spy um This one asks you the the trivia questions through the serial terminal So you connect with to or putty or something like that and then it's kind of like command line answering the trivia stuff. So We'll build something similar to this, but we'll try out different interfaces for it And I think I'm gonna start with the server I'm gonna take my test server code I'm just gonna change that out to trivia and then Just put hello trivia in here for now so we can test and see if it's working You print the network Okay, triva That says it's listening Now we go to here we go to the pico's ip address, which is this Uh, actually I did change it to That which says unable to connect. So one thing is we might need to Not have this file on gosh dang it show me the hidden files Sorry, there's some chance. It's gonna open this up after I touch it and I don't want to do that because it has my Stuff inside of it. So that says address and use which I think is probably because of the way that I had the dot emv Um First thing we are gonna do is give ourselves a reset Bodge wire here The pinout is on the back. So we need to find one that we can see I think we need the whole data sheet though Zork on a feather Be Zork on a feather Not sure what that is Zork. Can I just go to the big one? Okay reset. Is it run? Is that right? Say it's run Of course, it's like right in the middle They'll like count forever to get to there I think it's run and I think you jump it to ground to Get it to reset so ground Ground we have three from the back on both sides third from the back Back being opposite the usb So then for run it's Because they have to be different. Yeah run is reset. Okay Oh zork was one of the adventure games I gotcha Euro text game That'd be kind of fun I have a javascript library for making text-based games You'd not have something similar for circuit python, but it would be fun to do So we're gonna go from the ground one two three four five the fifth pin is going to be another ground Six seventh pin is run seventh pin after The ground two three four five six seventh pin after the ground And this happens to be in line with the bottom of this chip pretty much Which it is On this one as well. I'll be it filmed from an odd angle that maybe makes it so it doesn't seem like that So we should be able to go touch these together And get a reset Touch them together and we got a shutdown I recycled it Okay, this time it thinks it's on 132 port 80 Oh, you know what we never did we didn't put this here actually Oh, you know what the problem is actually oh shoot Yeah, thank you. That is the wrong port. I think I know. Oh my goodness. It worked. Okay There we go. Okay. I was thinking the problem was that my wi-fi was on ethernet No, my wi-fi was on ethernet my laptop is on ethernet the computer we're on is on ethernet but The circuit python devices on wi-fi and devices don't always see each other Um in this case it looks like they are though, but I swear I've had that problem before Okay, so we got this responding um So now let's see. How do we want to do this? I think when you first go to trivia page it I wanted to um I wanted to ask you how many questions And what category do you want? Because the api we're using has the ability to do both This won't really be a function But we can use category dictionary wi-fi on ethernet. Yeah, uh, okay, and then I think what we want is We want an endpoint that's going to return this object for us Wait, can you not have we not we shouldn't have base Do we call this trivia categories So let's have that send back the categories dictionary So now if we request that We get back json object with this stuff inside of it So we should be able to consume that on the front end So let's make a html page trivia web index.html trivia Okay Now let's try to have this serve the page Uh, which I don't actually know how to do off the top of my head I'm pretty sure that there's a way Probably fail anything about tv actresses that involves the Kardashians and stuff Yeah, the the question categories range from Kind of like pop culture stuff that I know nothing about to computers and video games, which I know a little bit more about Not too much Let's see if there is an example Or an example that hosts a page File name equals index html We said file name equals trivia web index Oops, don't need that Oh address in use address in use serve forever ever returns Can we try catch this or something is this like it feels like this would be stopping it from releasing itself Oh and back to working Okay Now we are serving our html page. So inside our html page we can have Select ID Uh category Select and then script Uh, let's see here category select and function Load categories fetch slash categories function response function response json catch Okay Uh, let's see. I don't remember the right way to do this Except evans in sutherlands One trick question about the teapot. Yeah the teapot Utah Not tennessee Uh, okay, so we get response we call response json response.json Really we return return response json Yeah, we return it because this is an arrow notation function Which means in here Oh, we are in javascript land response json And then let's call load categories And was reset review. There we go. Okay, so we got our object which has all our categories inside of it So now we want to make those into options and put them inside of our select So in here, we're going to go for Let i zero less than Response json. What's the thing though and then but this is actually just a dictionary, huh? Hmm, how do we loop over a dictionary in JavaScript? We don't call them dictionaries, but Key value in diction, but this is that's That doesn't work. That's not real. Is that real? 2017 2015 script five For each object keys object entries value Let's use this one object is this Yeah, let's make sure that works and then what we'll do is we'll be making a So a an option from each one of these Oh, we got that thing again. I don't know how I don't know why sometimes that's taken Okay Got those Now we're going to go document create element option Let's see Let new option Equal that new option That Say value equals key New option dot inner text Equals value And then we want to append it to our select. So we go category select append new option address in use third way to make it disconnect Like reset or something It's so weird too. It's not every time although it feels a lot more like every time now, doesn't it? I'm gonna try the reset wires didn't exactly work last time though Better this time. Uh, one thing is we don't get to see the first prints that way So I guess we'll see if it worked Nice, there we go Okay, there's our category We want also a input for the number of questions Close the connection on your code Close the connection How do I'm not sure how to close it? Uh, is there like because it says serve forever will not return I don't know. How do we get control back unless we if there's something we could put in here? Maybe I don't think it's been printing this exiting though Yeah, it just says listening Then trace back on serve forever I guess could I catch os error and then like Do something about it? No, there's no other functions Just route and serve forever You know, maybe I do micro controller reset Give me there. I'm not sure Weird too. It's not every time It got the os error. Actually it was it did this time so like wi-fi enabled stop station This is enabled. Can we set it to false or is it like get only? Oh, thank you Tim's it TMZT for the loop there Reach sounds like it'd work Dom content loaded DENT Need a json parser and javascript finger raise uh Yes, I mean we have a json parser if we need it I think in this case fetch is doing it for us or not really fetch but response that json inside the fetch Resolve method or whatever write out radio Enabled boolean true and the radio if you set the value to false any open sockets will be closed Hmm, I don't know if this works Didn't work Hmm Radio has no object enabled Enabled, but I spell it off You close the socket. Do you have to do a full build out of the connection again? I'm not sure To be honest, I'm not really sure how to close the socket because This thing says it never returns And it doesn't seem like This is ever getting executed even when I do control C I'm assuming if this would work that it would close the socket, but I don't actually know Um Yeah, I don't know how to stop it. Basically, there's not like server dot stop or close or anything This is weird though, right? Der Wi-Fi radio says Enabled is right there, but you try to access it And it says has no Attribute that's is there microcontroller dot reset You know actually before we try that What if we had a If we slept first Maybe it's just like because it resets and it was just running a second ago. Maybe it does shut itself down, but it's Not having enough time Uh Waiting extra time does not help it That seems to do though. I'll save it in a minute for now. We can try this Okay, and we want to default that to 10 because that's what the api default is Maybe interrupts are disabled value equals 10 Interrupts are disabled control c control d to do a reset. Yeah, I know That part, but that's uh, not working That's not um Well, maybe I need to maybe Maybe it's specifically saving the code So like the problem is so like I just do a control c right and now I'm going to go save the code Both the index and the codepie have changed a little bit Control d and now we get this address in use and I go control c Well now we have a reset inside of it But can control c control d is not letting this work. It's not coming back and letting me use the address But microcontroller dot reset seems to So we want a submit button HTTP server start Wi-Fi radio enabled. Yeah, I tried Wi-Fi radio enabled, but that was not working either It says it's there inside dur I did like import Wi-Fi and then I did dur Wi-Fi radio It says enabled in the list, but when I try to use it or access it It says attribute not found or something So like right here when this this code came from trying to do Here's the dur as well. So dur Wi-Fi radio shows enabled right there But the next line here I went Wi-Fi dot enabled to make it print and it says attribute Ah, shoot. I didn't do radio All right, we'll try that next time Yeah Thank you So I guess let's try this back to this way So it's so weird too like sometimes it doesn't have a problem like This time it didn't have a problem No, yeah, see here it says radio. Yeah, I did it wrong in one way. I did it wrong one time But it's still I think it is having the same thing So import Wi-Fi Dur Wi-Fi radio print Wi-Fi radio dot enabled Through okay Can't set it it works if we access it, but it doesn't let us set it We'll do the reset There is stop How do you stop So I see how I could use start and then be calling pull But I suspect I still will need Like a stop or a close or something like that Is there disconnect It's interesting. This this says you can set this but Didn't seem to work in our case connect Reconnections are handled automatically stop the hcp I don't see a disconnect We got we got our category. We got our count. We got our button What we want to do is when you click on the button We want to basically send the category And the count back to the back end And then get The questions from it How do we get data out of our request? We want I guess, how do we need to find route? Maybe We get the data off of request Spons though quest raw request here request our request river dot underscore dot stock dot close Step dot underscore We do a post method Route path method. Okay Oh wait now this goes up here start button Oh start button How do you put data into a post body Which goes on an object network error post to get questions But no response How do we get no response? Cyclops froth at the mouth Oh my uh the cyclops character questions Okay, there's our address in use Now sock dot Would we do sock dot disconnect or something? sock dot close Doesn't seem to help it So it gets address in use The thing about this is it reconnects kind of slow and then I think we missed the print already So why do we get no response? Didn't get any print out either I guess we would need to do this probably Uh see you to shippu. Have a good night Was it just posts that don't work? Would this need method equals? So weird. I don't get sometimes It's fine and other times it This doesn't work So weird. I don't understand like What is happening to this Why do we get no response? Oh wait. No, this is what we sent Connecting two milliseconds and then nothing else No cores and type Well, but we're not seeing it come through on the server side either Oh Are we we are just kidding. We actually are Okay, I know what the problem is then we don't we we uh You didn't do this then response Function earn response JSON object console Log oh function Also, we're not returning inside of here, which is probably why we're not getting anything returned. Kind of makes sense Okay, I should have Gone before I started but I didn't so I apologize when I have to step out and run to the restroom real fast and then be back Uh, let's say That for now. Okay, BRB. Sorry This will send it something back Uh Let's do that also Just gonna get a response We didn't get to print out this time either There we go. That time we got 200 responses JSON with success true. Okay So what we want to do then is We need to get well, we need to put the category that was chosen and Account into the request that we are sending here Whoa Okay, that should send them through We got address and use Theresa No connection, but it's back R Where we get the body And we split on double new line We split on double new line that should be this two characters here And then if we do index one it should be the body This is very primitive it wouldn't work if there were double new lines inside the body or anything But I think it should work for this instance Well, it's actually just raw request request body equals Row crest split New line new line one address and use Microcontroller.reset is nice. I guess I could be using the reset wires. Maybe I don't know if that would be any quicker This time it seems like it crashed though, didn't it? this index out of range Or is it triple new line? No, it should be double new line It's double new line, but it's with carriage returns also Okay There we go Now we got our body. So now we could go request body Object is json loads quest body Yep, that's what it yep You're both right And it was a line feed and new lines. Yep request body object So now we have it as an object And so now we should be ready to actually fetch our trivia from the trivia server And in order to do that we need To do this Is this gonna let me do this? I don't know. Can I have Can I have the server running I could pool Why does this not fill in? Let's not chase on Like it allowed HTTPS to be set up I still sometimes get this hanging request This one doesn't print or Turn This time we got it. Yeah, there's our response with all of our questions in it It took it a minute. It took it. I mean it took a couple seconds 9 9.0 seconds You know not the fastest thing in the world Theoretically we could be making this request to the trivia server from our front end, but I think this way of Doing it through the web server is kind of nice to be testing out the pico w So this will basically act as A proxy for the trivia server. We can send it account in the category By filling in these values And it will give us back The questions We didn't actually print or do anything with Oh actually Seems like we should have done something with it Oh uncaught in promise Network error Network error So did the first one fail And then the second one succeeded Did the first one failing cause Java script on the page to stop working But the next request succeeds Why does the first one fail This time we got it We probably need to have like error handling on this too because if this fails like We want to return something else probably type error network error when Attempting to fetch resource Not found. Oh, that's the Favicon This is coming from the favicon The thing is the next request is working But the code is broken. It's not printing It's not printing from here This is wrong Same closing Oh, I saw it. There it is. Okay Results has our questions They're all difficulty easy. No, they're not. They are all category general knowledge Perfect Does the catch work? Uh, I'm not sure I don't think we've seen it work But I also had it coded wrong before so We didn't really give it a fair chance Okay, so now our front end Is able to get questions From the back end and so From here We would want to Hide this stuff Do Set up do Set up do and then so one thing we can do is hide this stuff Let's make a let's make a variable for it. Let's have two more of these Set up div Oops Uh question div Question div Set up div Div ID question Div ID question Text Uh So, yeah, let's start with that. Let's just try to get the question text showing We'll worry about answer buttons and stuff like that here in a minute Uh, so what we want is actually This doesn't matter too much, but I'm gonna do it just so it's kind of consistent. We want question No, we want. Yeah, no, we want question div display none And then in here we want to go Once we got back our questions we want to go, uh Question div style display block And setup div style display None So this will hide the set up div show the question div And let's also put the first question inside the question text question text Whoops Question text question text Intertext response object results Zero Question Results zero Question One thing is we'll want to URL decode it probably We'll worry about that in a minute Everything works though. This will get the questions and it will put the first one inside the question text And it will hide the setup div And we probably got address and use no, uh network error So I don't know did that come from our catch in the promise? Because we did do this. I guess I should have done like Let me try again though Hope we got network error again. Can I refresh this page? This page works. I should be back. Hopefully So it seems like this one failed But I don't know like if I just make another one. Oh, it's like stuck in there. I think right We probably need timeout or something. All right, let's try saving this Our response returning it. Okay How but it didn't actually make it Oh, it did finally. It just took it 10 seconds. Okay But it didn't do its stuff Oh, it says error type error Now it's like instantaneously gets error. Oh, okay. There we go. That one worked Gotta try it a few times and then we did get our question So one thing we need to do is Fix this kind of stuff uh the way we're going to do that is Cheat because I actually made part of this the other day But I don't remember what the code is Decode html What's it in a text area and then gets it back out Go intertext here. We would actually go decode html this Network error huh We get In use Only after we send the post No, it's soft rebooting It's stopped by auto reload A few short drops one second less than one second. Okay if error network error Here we go So we do need error handling better error handling Sweet. There's our question so 20 minutes If we use this neokey How would that work? If we use this The question is showing in the browser And then we would want to wait on the user To press one of the four keys To indicate their answer There are multi-choice questions. Well, there's some multi-choice and there's some true false But either way there's a maximum of four possible answers But If the user answers with this How does this page get to know? There's not really a great way Like the only thing we could really do is This page could constantly pull A different endpoint like check, you know check if answered or something And inside of there it would have some logic based on reading the Cherry keys and deciding whether they were correct or not The weird thing there too is then the python code here Would have to know what the correct answer is Which it could find out because it's got the data Inside this we could keep it in a variable So it could find that out I don't think I like the idea of the front end just having to pull an endpoint though And I can't think of a better slash different way Or the python code inside of here to tell The front end code inside of here That the user pressed a button So let's start with putting our buttons on The html page This will show the question and then it will show the four buttons below it User will click the button they want and then we'll send the results back to the server Like if the user got the question right or not Let's do that so We can also steal that from over here Uh, I don't have either of those yet. Let's just turn those off for now. I can put those in later The thing is we need to put the response into our response object So we put that inside here We're not going to do this because instead we're actually going to call show question zero Which we'll get it back out of this Set the text If it's a multiple it will Set the buttons And it will randomly choose which button is going to get the correct answer And which buttons are going to get the wrong answers If it's a boolean, then they'll be true false and then we'll make click listeners If all of that works Or when the user clicks on an answer It's like we got stuck Are we looking on space? Oh, okay, we still have 150k. I don't know. It doesn't seem like we got a response It's odd because we're getting this Hmm, I don't know. Oh, we had Interesting Maybe we had this issue even though it wasn't printing Or we just can't serve the index page anymore I don't know. This thinks it finished, but we don't see response data We don't have response headers either I don't think it actually finished It says 200 Stopped loading Well, seem to be stuck now So like my instinct is Somehow we made index dot html too big And that's causing it not to work So the way I'm going to try to test that is switch it over to this one, which is much smaller Well, this time we got two in a row Yeah I think index is too big now or something So this completed pretty much Well, yeah, it seems like this completed pretty much instantly And then the one after it printed and then return response, but then Our actual data is just not Coming through And from the browser side, it's like not actually getting Well, some parts of the browser Think it's not getting a response and some parts of the browser think it is Is like this says status 200 which means successful But like that's not true, right? It didn't even It doesn't show any response headers And it doesn't show any Response object And it didn't actually load the page And it seemed like that started happening after I added more stuff To this Where did our code pie go? Yeah, I don't know what's happening here This is saying 200 but It's not really right. We don't have response headers I don't think we're getting anything back. I don't know what's happening at the end of this nine seconds Something is happening that's making this think that it succeeded, but It's not really succeeding. Otherwise we would get headers for it We would see the response body And like it would render the page Well, this didn't actually save On a way process Is that an options? I'm not sure what you mean. Is it an options? Yeah add or runaway process I think yeah, I think that it doesn't stop correctly Sometimes Sometimes when it restarts Uh from saving code pie or index or whatever It works okay Other times it doesn't Is there a timeout on fetch? Timeouts at 300 seconds Or 90 seconds in firefox. We're not quite hitting 90 seconds Roller.aboard options Timeout equals Could be hogging the port. Yeah, I mean I think it is but I don't know what to do about it I don't know how to make it not do that Other than reset the microcontroller, which is what I've started doing which is why this is happening Yes, ox. Uh, yeah, we can't do that because it's not Linux You have something stale serving. Yeah, I mean, I think we do but I don't I don't know how to kill it. We can't ps ox because it's on a microcontroller. I don't think it has ps ox Or kill And it doesn't have processes in the same way as pc python This is micro microcontroller with circuit python. So it's not a full operating system The uh, is the camera still on this this it's not live anymore this device right here though This is what we're running the python on So it doesn't have that stuff I think this has got to be the size though, right because all I did was just delete that big script because now our script was kind of big I deleted that and then it's and then it worked Yeah, hard mode. We don't know about that. We might just be at a limit of Can't actually do that much stuff Try a 30 second timeout but that's not But that's not our fetch though. That's not our fetch. That's timing out, right? That's our page load This is not going to change anything could minimize the js. That's true I I probably won't I probably won't go that route because we there's still a fair amount of code that we would need to make the rest of this work And if I'm close to the limit, I don't just want to like fight the limit and minimize over and over again This has got to be timing out, right? It's always around 10 seconds Why does it get a 200 though? So we could I guess one. I mean we could take our javascript Code and we could put it online somewhere And then index could be loading javascript from online I guess that could work. I may just tap out on the Web server methodology here though What does this actually do? If file name try file length Then file response Can you kind of time out in here? but I might Give up on the web app version of this And maybe uh tomorrow's stream because we're getting close to time as well But I will be back for tomorrow's stream at 10 a.m central time Maybe what we'll try tomorrow is get the display set up and use the 1 by 4 neokey Had file name length 4582 After send file response But the browser doesn't actually get it premature end of content length the limited message body Expected 4502 received zero I don't know what this does That walrus operator I don't know how that works All right, we'll put a few more prints, but I'm probably gonna call it a night here pretty quick And I think yeah, I think we'll just try Going the other way tomorrow. We'll try going with display. Oh and the uh The 1 by 4 neokey walrus. I I'm not a hundred percent sure if that's what that is I know there is a thing called the walrus operator. I think maybe that's it I'm not actually sure Keep up the hard work. Don't give up Yeah, I appreciate it. I mean, we'll get it. We'll get something going one way or another It's too send Sleep for sure. Oh, yeah, I mean, I definitely be sleeping tonight, but I don't really know what memory view is Yeah, colon equals. That's what we had Yeah, so I think that was but I don't actually know what it does Generally or in the context of this code Maybe we should have printed bytes sent Interestingly, this thinks it did send four five eight two From here Well, I don't know You get the same thing from this one still Yeah Memory view it's like plus equal but something to do with references for dictionaries you like see stuff in this or I really know what memory view is 60 Returns the value after assignment So it assigns it into here, but also returns it which then in our case is evaluating it for its truthiness Maybe hero So I do think For some reason we are Turning back nothing so maybe what we'll do is Tomorrow we will try to See if we can verify that this is simply a problem caused by returning pages that are too big Uh, maybe I'll try it on a usp32 s2 and see if it's be the behaves the same Um And maybe we will try it on a page that doesn't have javascript, but we'll keep adding more Or mipsum or something to make it bigger And see if we can find out if it fails the same way consistently Oh, that's not what I wanted to do Yeah has the data here Just doesn't actually get sent But by the time this gets to here it thinks that it sent 45 82 bytes But on the client side, we're actually receiving back zero This con.send is con This is request buffer size Not response buffer size socket dot accept It's a socket or socket source Pool pool must have a send But that's in native code. We can't really look inside of it very easily All right. Well We gave it a good try I think I definitely still learned a lot about HTTP server, so I'm happy for having done this Uh, I will try to isolate tomorrow like If it is simply the case that if your index is too big that it causes this error Uh, if we can narrow that down to being true Then maybe we can also try to figure out around what size it happens And then if we can figure that out We could submit an issue with some reproducer code And an index html that causes it reliably Maybe that will make it easier to look into Um, so I think I'll do that tomorrow Um tomorrow morning at 10 a.m central time is when I'll be back Uh, I'll be on my own channel at that point not the ate a fruit one I'll drop links in the live broadcast chat when I get started with that Um So I'll probably work on that a little bit see if we can narrow this down And then I may go with the other approach. I may try the uh Put the questions on display. Oh and have the neokey Buttons, and maybe we'll try We'll try that way See if we can get anywhere that way It will try esp 32 s2 as well just to see if that makes any difference um But thank you to everybody for watching. Thanks for everybody that hung out and Asked questions and made gave comments and things in the chat definitely always appreciate everyone hanging out um Yeah, I hope everybody enjoyed the show and I will uh, I'll catch you next time Which again, that'll be tomorrow morning at 10 a.m central for me Uh, I gotta go stop this cat from getting into trouble. So I'm gonna go and do that Hope everybody has a good night and a good weekend, and I'll see you later