We tried to program an Arduino from our Raspberry Pi 400, using Arduino IDE, but an old version because the updated version does not finish launching correctly from Raspberry OS. We take the opportunity to see what little things can be done with Arduino. Music for internal. Subtitles in Spanish and English.
Hello friends, Virtus Dante channel, here I am again with you, after a few days, or maybe weeks, a bit down with the issue of covid, but hey, recovering.
Forgive me the image, the beards, the hat ... it is that, to put it in some way, I go disheveled.
Anyway, what happens?
I've been doing more things with the raspberry pi 400, here, with which we already have several uploaded videos.
And interesting things, I have tried something very normal, like the image editor with [ __ ], and it works well, no problem, you just have to get used to it, you have to learn to handle it because those of us who come from PhotoShop find it a bit difficult to change, but it is the There is an image editor for Linux, perfect.
Well also a very cool thing that I wanted to try, was to program arduino from the raspberry pi What is Arduino?
For those of you who do not know, arduino is a card, a plate, it can remind you of The raspberry itself, which is, has a microcontroller and a multitude of ports for connect the devices that we can control through a program that we record on the board.
The microcontroller works, it begins to loop, loop, and does what we tell it to.
Do we have an example?
Well yes, let's see, here we go, this would be a mega, mega arduino because it is a slightly larger, there are different formats, just as in raspberry we have the pi zero, the pi 3, the pi 4, the pi 400 inside the keyboard ... because of arduino we have different formats as well.
This is a mega, which is the biggest arduino we found.
The UNO, which is the normal one, would be something like that, and then there are even smaller ones, and, as you can see, it has a multitude of ports, this would be to connect it to the computer, feeding...
And what can we do?
Well, control devices, I'm going to give you an example, because I installed the arduino ide on the raspberry pi 400, to put a little program in this arduino and make a demo how it works.
So, I'm going to start the ide ...
I have to say that it has not been easy, there have been problems, let's see now when start the IDE, you see, it gives me a lot of warnings about libraries, this is because they are libraries modern, current, and I had to install the old IDE, version 1.6, when in the most modern reality is 1.8.13 that is available from the arduino page, you can download and install it on your raspberry pi because it is compiled for architecture ARM of our Raspberry, but nevertheless when I gave it to execute it seemed that I was going to start, but the ide did not appear, the ide did not appear and I could not sort out.
So I decided to install the old version, which can be done simply from the line command, and with this old version it gives me problems with the libraries that I have current that I brought from the PC, with which I am going to make a very simple example of controlling a buzzer, a buzzer is a speaker, with our arduino mega, this one I have here.
Well, here I already have the arduino IDE, development environment, within this environment we program in C, and I'm going to open this example buzzer.
Here it is, my little program, as you can see very simple, it is a few lines here I have to do buzzerEscala (), I'm going to make it do nothing ... this is the, what I was saying, the loop, the loop, I'm going to make it do nothing, and then I have these functions to make an example, but right now I don't want him to do anything.
Well the first thing I have to do is connect the arduino to the raspberry pi via the USB port It is already connected.
Well now, as you see here, I have the card, I have selected what it is, the mega 2560, there are a lot and these are from when the old ones, but good.
The port of what was detected, and if I now send the program, it compiles me and sends me the program to the Arduino.
Compiling, loading ... loading finished, it is already loaded, but as it is since do nothing, it does nothing, of course.
And now, what I need is the buzzer, we have said that we are going to make an example with it buzzer, this is the buzzer, a tiny little speaker ...
Let's connect it, it has two pins, one is to ground and the other is to voltage, so give the tone, and I have the tone on pin 13.
Each of these holes is numbered, they are pins, there are 13, I have one here for ground, and another that is pin 13, our speaker is already connected, and now I will tell you in the program let him do me, the buzzerEscala () no, let him make me buzzerTest (), and he will simply do me a couple of beeps.
I load the program, it starts and there we have it.
A little nonsense.
But we are going to improve it a little bit, doing the musical scale.
I'm going to cycle the musical notes up and down.
I have it already prepared, this is, you see, these are the tones.
This is the loop to go up, and this is the loop to go down.
I compile and send the program to the board and there it is.
I'm going to bring it up to the microphone.
Well, entertaining for those of you who have never done anything in electronics, with plates nothing can be quite interesting, that's how I got hooked.
And, to cheer you up, I'm going to give you a little more cool thing, let's see, this sketch.
Here I have another program open.
This one is a bit more elaborate, but at the end of the day what we are going to do is a melody.
Notes are encoded as tones.
I'm going to send the program to the Arduino.
An important little thing, because here I have defined the buffer with pin 11 and before we had connected to pin 13.
Well, from 13 to 11.
And he takes ground that we do not forget.
What, does it ring a bell?
Yes sir, StarWars.
I'm not a huge StarWars enthusiast, but I do like the music.
Well, this has been an example of programming arduino from raspberry pi.
And, well, as a curious thing, what can you do?
Other things you can do with arduino, something else, well here I have some toys ...
What is this?
A laser turret.
What toy is this?
Well, here is an Arduino, and here we have a joystick, a button, a led, and the turret, the turret that carries two motors, and a laser, a laser that is operated by the joystick button.
We are going to connect it to the USB so that it is powered through the raspberry pi, and here we have it.
We fix it with the yellow button, there it would be fixed. Look, turn the led to red, and this wants say I can shoot the laser. Here, take with the laser. Do not aim at the eyes, that's why I have it on with the red led warning, when I libero it turns green, the motor I can move it and it activates the laser but it doesn't work, to shoot the laser I have what to arm it: button, arm and fire.
Well, it's pretty cool, it's a little toy, simply educational, it can be made even more complicated, but it's pretty cool. If we open it, then we will see that is an arduino UNO what is inside, with wiring, and all packed in a Voll-Damm advertising box that came with headphones. The box of Voll-Damm? Well, I said to myself: since I'm going to make a weapon of mass destruction, why not do it with class? Let's try another toy.
For this I don't need to connect it because it has a battery, I just have to turn it on here.
And it is a box.
Here we have our box.
Which has a sensor, if I hit here It shows me the time there in that false mirror. If I hit twice greets me. Funny. Again, once, the hour, twice, greets me I'm going to leave it open.
It looks like a bomb, but no, much more innocent than that. It has a couple of motors, the clock display has an RTC clock in real time, with battery, so that it does not lose the time when we unplug it, they have something else, like a card reader ...
But hey, they are things that can be done, entertained ... And, speaking of code reuse, It is very important that I told you about the amount of resources and code that there are as examples about arduino and programming for arduino on the internet, a lot, but what happens? no They are programs of very good quality, let's say, they are programs that are difficult to reuse.
I've been worrying about making my own arduino libraries, so when I want to use a motor, when I want to use a distance sensor, when I want to use the buzzer, or different devices I only load the library and program much less what it's on the show. If I show you the turret program, You will see the program itself is nothing, it is simply to define the pins where we have connected every device on the arduino board, and you're done, and launch the turret, here it is the code for the turret itself. I this class, is in programming object-oriented, this class, notice that it is not very extensive, I take it to another program I want to do and I have another turret already available. Anyway, nothing more for today, just let you know the next video of what is going to go: an unbox, an unbox, a little package that I have here, that has arrived today but that we will open tomorrow or the day after, and that contains at least two very interesting things, one, a raspberry pi 4 of 8 Gb, the most powerful that exists right now, we remember that the pi 400 is only in a version with a maximum 4 Gb of RAM, but I have asked for a pi 4, which is the box, with 8 gb of RAM to test its performance, because we remember that when we did the tests on the pi 400, I complained, asked more RAM, and we are going to see if indeed more RAM is noticeable or not noticeable, we will check it with what's here. And another very interesting thing I have here: an AIY, but what is an AIY? For those who know what DIY (do it yourself) is, AIY is "artificial intelligence yourself", do intelligence artificial by yourselves. And it is a kit to create a Google assistant, a Google assistant, with a cardboard box, because it goes with a raspberry pi running inside, a pi Zero I think it is, I'm not sure, when we open it we will see it, and I think it will be a good experiment to try to assemble it and then test how it works. So well You already know if you like the video you give the like, if you do not like it without problem you give it we like it and that's it. And, above all, if you liked the arduino theme and wanted, I don't know, learn a little more, you would like me to give you a little tutorial, a demo of programs, to teach you to program a little and do your first steps, in the comments You leave it all on for me and, come on, full of courage. Next best picture video, huh.
See you later!