1
00:00:10,000 --> 00:00:11,000
Hello, friends.

2
00:00:12,000 --> 00:00:19,000
Today I will tell you how to control the brightness of an LCD using python.

3
00:00:19,000 --> 00:00:26,000
In this case, I'm just using another library that is numpy.

4
00:00:26,000 --> 00:00:29,000
I just call that library, as you see over here.

5
00:00:30,000 --> 00:00:36,000
Import numpy as NP, then import and max.

6
00:00:36,000 --> 00:00:37,000
Import time.

7
00:00:38,000 --> 00:00:45,000
After that task, start the task or assign the task task and the next task.

8
00:00:46,000 --> 00:00:49,000
In this case I'm just using analog output port.

9
00:00:50,000 --> 00:00:57,000
Task dot a0 stands for analog output channels dot add analog output voltage channel.

10
00:00:58,000 --> 00:01:01,000
My device name is one and audio output.

11
00:01:01,000 --> 00:01:04,000
I just set the my channel range.

12
00:01:04,000 --> 00:01:08,000
In this case maximum is five and minimum is zero.

13
00:01:09,000 --> 00:01:12,000
Start the task task start.

14
00:01:12,000 --> 00:01:15,000
After this I just use start.

15
00:01:15,000 --> 00:01:17,000
It will start from zero.

16
00:01:17,000 --> 00:01:21,000
Stop at five and the step it will take from 0 to 3.

17
00:01:22,000 --> 00:01:24,000
Now I just call numpy.

18
00:01:25,000 --> 00:01:28,000
So brightness is my variable.

19
00:01:28,000 --> 00:01:34,000
That is np dot arange start comma stop comma step.

20
00:01:34,000 --> 00:01:35,000
Okay.

21
00:01:35,000 --> 00:01:41,000
So it will start from zero and goes to five in a step of 0.3.

22
00:01:41,000 --> 00:01:48,000
Now I'm just using loop that is my for loop brightness level in brightness task.

23
00:01:48,000 --> 00:01:49,000
Right.

24
00:01:49,000 --> 00:01:50,000
Brightness right.

25
00:01:50,000 --> 00:01:53,000
Level it will take from brightness.

26
00:01:54,000 --> 00:01:56,000
Then print these values.

27
00:01:57,000 --> 00:01:58,000
I just use index.

28
00:01:58,000 --> 00:01:58,000
Right.

29
00:01:58,000 --> 00:02:07,000
Level is equal to bright level over here from the time time sleep 0.2 seconds task.

30
00:02:07,000 --> 00:02:08,000
Right.

31
00:02:08,000 --> 00:02:12,000
Zero then task stop after this task close.

32
00:02:13,000 --> 00:02:18,000
Let's run it and check what happened on the hardware bar.

33
00:02:18,000 --> 00:02:27,000
On the hardware part I just connect all three pin of led to the analog output zero and negative to the

34
00:02:27,000 --> 00:02:28,000
ground.

35
00:02:29,000 --> 00:02:30,000
As you see over here.

36
00:02:30,000 --> 00:02:34,000
Yellow one is my ground and ground one is my positive.

37
00:02:34,000 --> 00:02:35,000
This is my Led.

38
00:02:35,000 --> 00:02:37,000
Now I just run it.

39
00:02:39,000 --> 00:02:40,000
As you see over here.

40
00:02:42,000 --> 00:02:43,000
This is my brightness level.

41
00:02:44,000 --> 00:02:47,000
As you see it goes high and then stop.

42
00:02:48,000 --> 00:02:51,000
It goes from 0.0 to 4.8.

43
00:02:52,000 --> 00:03:00,000
And now if you want to change the time sleep, let's say it is 0.5 seconds.

44
00:03:01,000 --> 00:03:07,000
And again, I am running it, run it now.

45
00:03:08,000 --> 00:03:13,000
It will take 0.5 seconds and it will generate signals with some delay.

46
00:03:14,000 --> 00:03:20,000
As you see, white level is from 0 to 4.8.

47
00:03:21,000 --> 00:03:21,000
Okay.

48
00:03:22,000 --> 00:03:26,000
Basically, in this case, it is calling numpy library.

49
00:03:26,000 --> 00:03:29,000
And according to that, it will generate signals.

50
00:03:29,000 --> 00:03:38,000
So this is how you can generate or how you can control the brightness of Led using Python with the help

51
00:03:38,000 --> 00:03:38,000
of an eye.

52
00:03:39,000 --> 00:03:40,000
Thank you.

