ChatGPT instant C++ script for programming - Great for Arduino beginners!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I'm no expert coder but I do have a laptop with an internet connection and fingers to mash the keyboard with and along with help from chat GPT and AI chat bot I'm an expert coder this Advanced AI can create custom programming code based on your specifications for example I told the AI I had an LCD screen and a soil moisture sensor not only did it write the code but it also told me how to wire the modules to the Arduino this AI could be incredibly useful if you have little to no knowledge on coding simply tell the AI what your Hardware is and how you intend to use it and it does all the hard work for you stick around to the end of this video because you will not be disappointed this video is proudly sponsored by jlc PCB I've been using the PCB manufacturing service before they became a sponsor of my channel I've used the printed circuit boards and several build videos and I've always been impressed with the equality speed and low cost prices start at two dollars for five printed circuit boards so wave goodbye to Vero board and take your projects to the next level with a custom PCB from jlc so what are the benefits of using this AI bot to do your coding well it could potentially save you hours typing away manually making the script yourself if the bot proves to be quite proficient at creating a script there might be little to no debugging required so let's get right into it and see what this is about so here's the website now you will have to make a account with them so that you can log in and use the chat bot however it is completely free to do so at least at the time of making this video so let's click on try chat or GPT all right let's start off with something basic let's ask the AOA to create an Arduino script that randomly blinks an LED the LED will be grounded to pin D3 shut the front door good grief what a thing so let's just review what happened all as I said was create an Arduino script that randomly blinks an LED the LED will be grounded to pin D3 that's all the instructions I gave it it returned in theory a working script that performs that function it also commented what all the commands do in the script so that a human can understand them and modify the script if need be and then it also right at the end explains what it's done and the functions in the script if this works this could just be amazing all right let's hook up an LED to an Arduino flash it with the code and see if the script works I then copied the script generated by the AI and pasted it into a new IDE sketch I selected the correct board for my application which in this case is an Uno and selected the corresponding com Port it's connected to via USB I then uploaded the sketch to the Uno so pin D3 is connected to the cathode of the LED we've just got a resistor that will allow five milliamps to pass through the LED and then we've just got 5 volts out from the Arduino to the LED so let's plug it in to some power see if it works wow do my eyes fool me that is a randomly blinking LED this is just mind-blowing how easy this is made coding far out I wonder how far we can take this like you know you've got things that are really really complex scripts like Marlin software used to run 3D printers I don't expect it could code that and if it could it would take an immense amount of parameters like you'd have to sit there and give detail by detail all the inputs and outputs so I don't know if it can be used for super complex sketches but really there's only one way to find out so let's try something more advanced so here is what I asked create an Arduino script based on the following parameters pins d8 and D9 are input pins with internal pull-up resistors enabled pin d10 is an output pin which normal state is low when pins d8 and D9 simultaneously go low pin d10 goes high for 2 seconds after the two seconds d10 returns to low normal state while the timer is counting down if d8 and D9 return High then go low again the timer is reset for another two seconds I would like to monitor in real time the state of pins d8 D9 and d10 in the IDE serial monitor and this is the result once again I copied the AI generated script and pasted it into a new IDE sketch after uploading it to the Uno I connected the Uno based on the specifications I provided the AI however there seemed to be an issue the LED was on pretty much all the time and when only go out briefly when I grounded the input pins and here's where things get crazy so I go back to the AI and said there seems to be a problem with the script when pins d8 and D9 go low d10 briefly goes low but not for the specified 2000 milliseconds this is the response I apologize you are correct there is an issue with the script I provided as if this wasn't crazy enough not only does the AI apologize but diagnose the issue then fix the script in a matter of seconds oh boy with the new script uploaded to the UNO let's see if the AI fixed the issue so we have our LED here of course the orange leads are my two inputs that I can manually ground so if I just ground one pin the LED stays off good if I ground the other pin the LED stays off if both pins are connected to ground at the same time LED comes on and it stays on for as long as those are connected once they're disconnected it turns off now if I connect both of these to ground and just keep pulsing them it keeps resetting the timer so this script is functioning exactly how I intended so let's see how far we can take this let's make things a little bit more complex for the AI I have here an LCD module and a soil moisture sensor so let's see if we can get the AI to generate a script to monitor the soil moisture sensor and output the value on the LCD and I would also like to challenge the AI to tell us how to wire everything to the Arduino so we don't give it the parameters we're just saying we have an Arduino Uno we have this LCD we have this sensor you figure the script out and tell us how to wire it let's give that a go and here's what I said please create a script for an UNO based on the following specifications I have a 1602 LCD module and a soil moisture sensor I would like the soil moisture sensor monitored and its value displayed on the LCD screen please specify how the LCD module and soil moisture sensor should be wired to the Arduino Uno and here's what the AI came up with not only did it write the complete script but also told me how to connect the LCD and sensor to the Uno I didn't tell the AI that the LCD module uses an i squared interface so I asked the AI the LCD module has pins labeled ground VCC SDA and scl how should they connect to the Uno based on this new information it correctly identified the LCD was using an i squared interface and updated the script accordingly once again I copied the AI generated script and pasted it into a new IDE sketch then uploaded it to the Uno all right well the proof is going to be in the pudding now we have the Arduino loaded up with the new sketch we're going to follow the ai's parameters for connecting the LCD and soil moisture sensor to the Uno see if it works now I could power this from the USB or a power adapter but I'm going to use the tiki station this product was sent to me no obligations to use it or review it it was just sent to me and the fella said uh well if you find a use for it good for you I think this is quite a cool little power supply so you've got several different voltage outputs here you've also got a custom one that you can adjust through the trimmer here um and you can unplug this module and plug that into your breadboard if it's compatible otherwise you can just use this breakout board like I've got here so that's what I'm going to use to power the Arduino and for power input options you do have several I'm going to be using a USB type c okay so moment of truth let's power up oh my goodness um will it work with my hand it does it does it works with my hand and look at that it's either got soil moisture it could have just put a value there but it actually says soil moisture ah man this AI I don't know man it's it's cool but it's pretty scary I feel like I could really be replaced quite easily at this point but damn that is cool so I don't know about you but I am nothing short of astonished at how capable this AI is to recap we got it to write three scripts from us for US based on very little input from us two of the scripts worked flawlessly out of the box one of them needed a tweak but that was absolutely no trouble because all as we said was we've got a problem and it went oh yep sorry I'll just fix that for you you upload it boom it works and I would imagine things could get way more complex and it would still cope just fine we could have multiple sensors multiple user inputs encoders LCD screens and just go yep all good here's how you wire everything it's just incredible and really I think in one sense it's scary because it feels like we're being replaced as humans but the other thing is I think this is really good because it's opened up coding to a whole new group of people that don't either have the time or the knowledge to invest into learning how to code but now they can go down to the electronics store pick up some modules pick up an Uno tell us AI this is what I have and it will tell them how to wire it and here's your script for you hand it on silver platter just upload it and it'll go I mean it's just incredible and then if things don't go right the first time you can use it to troubleshoot so I'll leave a link down below for chat GPT if you want to check it out and also the tick station power supply I'll leave a link down in the video's description other than that thank you for watching and and hopefully in the next video I'm not replaced by an AI bot so hopefully I'll see you again bye for now
Info
Channel: Schematix
Views: 8,066
Rating: undefined out of 5
Keywords: chatgpt, artificial, intelligence, coding, script, sketch, arduino, programming, C++, easy, tutorial, beginner, IDE, getting started, electronics, schematix
Id: pvgq_xp__GM
Channel Id: undefined
Length: 13min 29sec (809 seconds)
Published: Mon Jan 16 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.