1
00:00:06,000 --> 00:00:07,000
Hello, friends.

2
00:00:07,000 --> 00:00:16,000
Today I will tell you how to acquire analog signal and with the help of this analog signal, how to

3
00:00:16,000 --> 00:00:19,000
generate a digital signal for that purpose.

4
00:00:19,000 --> 00:00:21,000
Over here I have a code.

5
00:00:22,000 --> 00:00:29,000
First you have to import your Arduino library to Python, then import time.

6
00:00:29,000 --> 00:00:34,000
After importing time, you just set a variable board.

7
00:00:35,000 --> 00:00:46,000
Inside this, you have to set up your Arduino board baud rate in my case Arduino and using and the baud

8
00:00:46,000 --> 00:00:47,000
rate for Arduino is fixed.

9
00:00:47,000 --> 00:00:52,000
That is 9670 and the com port is my com.

10
00:00:53,000 --> 00:00:57,000
After this I want to set up the digital pinmode.

11
00:00:57,000 --> 00:01:07,000
In my case over here in the hardware part, this is connected to pin number ten.

12
00:01:07,000 --> 00:01:10,000
That is pin and this is my potentiometer.

13
00:01:11,000 --> 00:01:16,000
And this potentiometer one end is connected to the plus five volt and another end is connected to the

14
00:01:17,000 --> 00:01:17,000
ground.

15
00:01:17,000 --> 00:01:20,000
And this black one is my signal.

16
00:01:20,000 --> 00:01:27,000
That is middle one that is connected to the wiper of my potentiometer.

17
00:01:27,000 --> 00:01:30,000
So it is connected to PIN number two.

18
00:01:30,000 --> 00:01:33,000
Over here we have my analog pins.

19
00:01:33,000 --> 00:01:38,000
So in the software part I just use board Pinmode.

20
00:01:39,000 --> 00:01:40,000
That is my output pin.

21
00:01:40,000 --> 00:01:41,000
That is for this pin.

22
00:01:42,000 --> 00:01:45,000
I just use value inside this.

23
00:01:45,000 --> 00:01:52,000
I just use another variable to read the analog signal that is value board dot analog read over here.

24
00:01:52,000 --> 00:01:56,000
I just set the pinmode pin number.

25
00:01:56,000 --> 00:01:58,000
That is my pin number two.

26
00:01:58,000 --> 00:02:03,000
So x I just use the formula to convert this value because it will read this.

27
00:02:04,000 --> 00:02:05,000
It will read in digital form.

28
00:02:05,000 --> 00:02:11,000
So I just convert it to analog form value into five divided by 1024.

29
00:02:11,000 --> 00:02:18,000
It will generate value of your potentiometer.

30
00:02:18,000 --> 00:02:28,000
Okay, so I just print it over here and I just put a condition over here as you see, if the value of

31
00:02:28,000 --> 00:02:36,000
potentiometer that is X is greater than three board, this will write to the PIN number ten high signal.

32
00:02:37,000 --> 00:02:42,000
If it is below three volt, it will generate low signal.

33
00:02:42,000 --> 00:02:45,000
And over here, I just put some time.

34
00:02:45,000 --> 00:02:46,000
I just put three.

35
00:02:46,000 --> 00:02:51,000
Okay, Let's say it is one second, 0.1 second.

36
00:02:51,000 --> 00:02:54,000
So let's check what happened to it.

37
00:02:55,000 --> 00:02:55,000
Run it.

38
00:02:56,000 --> 00:03:01,000
Now, as you see, the output voltage is 2.6V.

39
00:03:01,000 --> 00:03:02,000
It is below three.

40
00:03:02,000 --> 00:03:11,000
So my LCD is in condition when it is greater than three.

41
00:03:11,000 --> 00:03:16,000
As you see, LCD will glow when it is below three.

42
00:03:17,000 --> 00:03:19,000
It is in state.

43
00:03:19,000 --> 00:03:24,000
When it is greater than three, it is in on condition.

44
00:03:24,000 --> 00:03:29,000
This is how you can generate different conditions using Python code.

45
00:03:29,000 --> 00:03:32,000
So this is all about today's lecture.

46
00:03:32,000 --> 00:03:33,000
Thank you.

