ChatGPT instant C++ script for programming – Great for Arduino beginners!
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 Ive, been using the PCB manufacturing service before they became a sponsor of my channel. Ive used the printed circuit boards and several build videos and Ive 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 lets get right into it and see what this is about so heres 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 lets, click on try, chat or GPT. All right lets start off with something basic lets: 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 lets 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 thats 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 its done and the functions in the script if this works. This could just be amazing. All right lets 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, its connected to via USB. I then uploaded the sketch to the Uno, so pin D3 is connected to the cathode of the LED. Weve just got a resistor that will allow five milliamps to pass through the LED and then weve just got 5 volts out from the Arduino to the LED so lets 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, youve got things that are really really complex scripts like Marlin software used to run 3D printers. I dont expect it could code that and if it could, it would take an immense amount of parameters like youd have to sit there and give detail by detail all the inputs and outputs. So I dont know if it can be used for super complex sketches, but really theres. Only one way to find out so lets 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 heres 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 wasnt 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, lets 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 theyre 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 lets see how far we can take.
This lets make things a little bit more complex for the AI. I have here an LCD module and a soil moisture sensor, so lets 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 dont give it. The parameters were 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 lets give that a go and heres. 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 heres. 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 didnt 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 were going to follow the ais 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 Im 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 youve got several different voltage. Outputs here youve 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 its compatible. Otherwise, you can just use this breakout board, like Ive got here so thats. What Im going to use to power the Arduino and for power input options. You do have several Im going to be using a USB type c. Okay, so moment of truth lets 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? Its either got soil moisture. It could have just put a value there, but it actually says soil, moisture.
Ah man, this AI, I dont, know man its its cool, but its pretty scary. I feel like I could really be replaced quite easily at this point, but damn that is cool, so I dont 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 weve got a problem and it went oh yep. Sorry Ill 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 heres, how you wire everything its just incredible and really, I think, in one sense, its scary, because it feels like were being replaced as humans. But the other thing is, I think this is really good, because its opened up coding to a whole new group of people that dont 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 heres your script.
For you hand it on silver platter, just upload it and itll go. I mean its just incredible and then, if things dont go right, the first time you can use it to troubleshoot so Ill leave a link down below for chat GPT. If you want to check it out and also the tick station power supply Ill leave a link down in the videos description other than that. Thank you for watching and and hopefully in the next video Im, not replaced by an AI bot so hopefully Ill see.