This would give me a lot of the good parts of the arduino ide, just right up front right away within vim, and i could use vims build system but thats, not how we do it here. No, no, so im gon na make something of myself. Of course, plus were using lua, which means i can use plenary. Plenary has a job interface in which allows you to execute async jobs and actually scrape the standard out, which means we need to be able to execute this build and grab out a specific line. We need to be able to build the arduinos program and grab this line right here. This tells us where the tty to the arduino is and technically its baud rate, though we wont need to know it all right. So every single line that comes in we check to see if we have this little console to have tty acme line and then, if we do, we can actually parse out that dev tty part of the message. Of course, i had several off by ones. Oh, my goodness, this is louis worst part is the inclusivity of all the things. At the end, i swear still better than vim ninescript. Okay, still, what the hell are you thinking and betting, your own language, and now all i have to do – is actually read from the serial out, which is actually surprisingly easy. Im gon na use that async job interface one more time and use cat to follow the tty.

So all thats left now is for me to just write up a quick little program and send it on over to my arduino. So, im going to write this small little arduino program that simply prints out to serial every two seconds. So with my new building program, i should be able to compile it and if i see the dev part of the output, i will then listen to the cereal. With cat got him, i know you like that. So, like this video or else you suck can practically six thousand people be wrong. I dont think so so you can subscribe to make it up to me. Okay, its okay. I forgive you i i forgive you just sub so were reading from cereal. We are building our program, but were pretty much done right. No, we still need to be able to write to cereal. That is very important to be able to handle this all from within vim im gon na do that now. Writing to the serial port would be a lot harder if there wasnt one trick, and yes, doctors do hate this. If you simply just echo data into the tty, it will actually restart the arduino over and over again. But if you append to it, it will actually just write the data to the serial port and youll be able to have your program run over and over again and with vim. We can actually append to a file quite simply, and not only that we can append to it via range.

All right lets make a small change to the arduino program, where, if we find a new line from reading the serial, we will write it all back out. All right theres one more function. We need to write now this parts actually pretty dang cool, because youll notice here that is the starting range to ending range – were gon na write and were gon na pipe it into by appending into the path provided. So if we go back here to my previous program, i can do the quick building really quickly and then once it gets the tty, we should be able to send over messages to it. There we go, we have the tty lets, just grab this line and send it over that its in reverse, but thats totally it so there we go. We were able to actually take all this information and be able to pipe it all through using plenary jobs and pretty much cat and append right. It was fairly simple to do and it allows me to do some pretty quick, arduino iteration. I think i almost died there. I think i think i got the the black club. All right were better. I didnt drink, any water were just better. That was actually a fun about eight hour project. I did on a road trip. I had a blast building. All of that, especially like the window that was popping up, i know i didnt include all that because thats just way too much stuff, but i thought that was pretty awesome, so you better like the video in real talk thanks for the 100 000 subs, you guys, If you like, all this kind of content, we build everything, live on twitch and, of course, try to make these nice little videos for you on youtube.

So if you like this, you know make a little comment down below. Tell me what you want to see me build, because i will probably ignore it, but i will read it for you.

https://www.youtube.com/watch?v=igSfCLuA_Sk