Hello friends.
Today I will tell you how to generate multiple digital signals using Python with the help of Arduino.
So first you have to install.
This.
Okay.
Or you can say Arduino library for Python.
It will open in Arduino IDE over here.
You just set your board.
In my case, Arduino Uno is there.
You have to just set com port on it.
When it is uploaded.
You are already know is communicating with your python language.
So I guess taking some time every time when you want to communicate with Arduino, with the help of
Python, you just install this library.
So it is done.
Basically it is it interfacing fine.
So just go to IDL over here.
In the case of ideally you just open a new script.
So before writing the code, I just go to the hardware part.
In this case, I just want to generate four digital, three digital signals.
So I just connect ground.
Then I just connect PIN number 11, nine and seven.
Okay, so this one is my ground pin.
I just connect it over here.
This is my ground pin and I just connect the Led.
So over here, this is my Led ground.
I'm just sharing the ground with all the LEDs.
So over here, this is my ground and posted pin.
And this is my third pin led.
So the purple one is connected to PIN number 11.
The black blue one is connected to the PIN number nine and it is connected to yellow led.
And this is my seventh pin that is connected to the green one.
So over here, you can check.
So now we just go to the code over here.
You just call the library from.
Already know.
Import.
Hardy.
Import.
I do know this.
You just set the board.
Bowler is playing to.
Already know.
We're here.
You set the baud rate that is 9600 and also set the port.
Or if my come it.
Cool.
Now, after this, you just set the mode in mode.
In this case, I just use three pins.
So board dot pin mode.
In.
And over here, you just set up the PIN number.
In this case, I'm just using 11th pin.
Ninth pin and seventh pin.
So 11.
The mode is output because I'm just generating.
After this.
Just copy this command.
Multiple times because in this case I'm just generating three signals.
So just copy it three times.
Over here.
The pin number is.
Nine and the number is seven.
So all the three pins are assigned.
Now you have to just generate the signal for this.
So over here, gold dot digital, right?
Digital.
Right now you have to just assign the value.
So PIN number 11 will get high signal.
I just generate high signal through all the pins.
After that, I just change the signal.
So again, copy it.
So pin number nine is there and seven is there.
So the mode is output mode.
Just save it.
I just save it to my previous folder.
In the code.
I will share with you this code also.
So code is saved.
Now you have to run it.
When you run it, all the three Led will glow.
So in this case, as you see.
Connections are loose.
So as you see, both the all the LEDs are on or in the high state.
If you want to change the state, let's say I want to just change the state of middle one that is connected
to the PIN nine.
I just put low signal over here.
Save it and when you again run it, let's check the output.
Only two LEDs will glow.
Middle one is in the state of low.
So now you just generate a signal 101.
If you want to generate using these three LEDs, you can generate from zero zero 0 to 1 one one.
Okay, so this is how you can generate multiple digital signals with the help of Python using Arduino.