VMP502
V. 02
–
25/10/2019
12
©Velleman nv
Python Programming
6.4
Breathing LED
We will gradually increase and decrease the luminance of an LED with PWM.
Required Hardware
•
1 x Raspberry Pi
®
•
1 x breadboard
•
1 x LED
•
1 x 220
Ω resistor
•
jumper wires as needed
Pulse Width Modulation
–
or PWM
–
is a technique for getting analogue results with digital means. Digital
control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate
voltages between full on (3.3 V) and off (0 V) by changing the portion of the time the signal spends on versus
the time t
hat the signal spends off. The duration of the “on time” is called the pulse width. To get varying
analogue values, you change
–
or modulate
–
that pulse width. If you repeat this on-off pattern fast enough
with an LED, the result is as if the signal is a steady voltage between 0 and 3.3 V controlling the brightness of
the LED.
A duty cycle is the percentage of one period in which a signal is active. A period is a time it takes for a signal to
complete an on-off cycle. As a formula, a duty cycle may be expressed as:
Содержание VMP502
Страница 1: ...VMP502 BASIC LEARNING KIT FOR RASPBERRY PI USER MANUAL...
Страница 8: ...VMP502 V 02 25 10 2019 8 Velleman nv Programming C Programming Python Programming...
Страница 11: ...VMP502 V 02 25 10 2019 11 Velleman nv Programming C Programming...
Страница 17: ...VMP502 V 02 25 10 2019 17 Velleman nv Programming C Programming...
Страница 18: ...VMP502 V 02 25 10 2019 18 Velleman nv Python Programming...
Страница 21: ...VMP502 V 02 25 10 2019 21 Velleman nv Programming C Programming Python Programming...
Страница 27: ...VMP502 V 02 25 10 2019 27 Velleman nv Programming C Programming Python Programming...
Страница 30: ...VMP502 V 02 25 10 2019 30 Velleman nv...
Страница 31: ...VMP502 V 02 25 10 2019 31 Velleman nv Python Programming...
Страница 32: ...VMP502 V 02 25 10 2019 32 Velleman nv...
Страница 36: ...VMP502 V 02 25 10 2019 36 Velleman nv Python Programming...
Страница 40: ...VMP502 V 02 25 10 2019 40 Velleman nv...
Страница 41: ...VMP502 V 02 25 10 2019 41 Velleman nv Python Programming...
Страница 44: ...VMP502 V 02 25 10 2019 44 Velleman nv...
Страница 45: ...VMP502 V 02 25 10 2019 45 Velleman nv Python Programming...
Страница 46: ...VMP502 V 02 25 10 2019 46 Velleman nv...
Страница 47: ...VMP502 V 02 25 10 2019 47 Velleman nv...
Страница 48: ...VMP502 V 02 25 10 2019 48 Velleman nv...
Страница 49: ...VMP502 V 02 25 10 2019 49 Velleman nv...