background image

 

VMP502 

V. 02 

 25/10/2019 

16 

©Velleman nv 

hardware PWM output, but it needs three channels to control the RGB LED, which means it is diffeicult to 
control the RGB LED with the hardware PWM of the Raspberry Pi

®

. Fortunately, the softPwm library simulates 

PWM (softPwm) by programming. 

RGB LEDs can be categorized into common anode type and common cathode type. In this experiment, the 
latter is used. 

Experiment 

 

 

 

 

C Programming 

1.

 

Change directory: 

cd/home/pi/IDUINO_SuperKit_C_code_for_RaspberryPi/05_RGB 

2.

 

Compile: 

gcc rgb.c 

o rgb 

lwiringPi 

lpthread 

3.

 

Run: 

sudo ./rgb 

 

 

Python Programming 

1.

 

Change directory: 

cd/home/pi/IDUINO_SuperKit_Python_code_for_RaspberryPi/ 

2.

 

Run: 

sudo python 05_rgb.py 

 

 

You should see the LED emit light of different colours. 

You can also modify the parameters of the function 

ledColorSet()

 by yourself, then compile and run the code to 

see the colour changes of the RGB LED. 

Содержание VMP502

Страница 1: ...VMP502 BASIC LEARNING KIT FOR RASPBERRY PI USER MANUAL...

Страница 2: ...ning and user maintenance shall not be made by children without supervision Indoor use only Keep away from rain moisture splashing and dripping liquids 3 General Guidelines Refer to the Velleman Servi...

Страница 3: ...tive transistor SGPT5053C 1 x LM35 temperature sensor LM35DZ 1 x active buzzer 5 V 1 x passive buzzer 5 V 30 x breadboard jumper wire M M different length 1 x 20P 20 cm male to female jumper 1 x micro...

Страница 4: ...w through the LED Usually there are red yellow green blue and colour changing LEDs LEDs are widely used due to their low operating voltage low current luminescent stability and small size LEDs are dio...

Страница 5: ...or_RaspberryPi 01_LED 2 Compile gcc led c o led lwiringPi 3 Run sudo led Python Programming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_RaspberryPi 2 Run sudo python 01_led py The LE...

Страница 6: ...VMP502 V 02 25 10 2019 6 Velleman nv Python Programming 6 2 Controlling an LED by a Button Required Hardware 1 x Raspberry Pi 1 x breadboard 1 x LED 1 x 220 resistor 1 x button jumper wires as needed...

Страница 7: ...e corresponding code when the button is pressed and the LED will light Experiment C Programming 1 Change directory cd home pi IDUINO_SuperKit_C_code_for_RaspberryPi 02_BtnAndLED 2 Compile gcc BtnAndLe...

Страница 8: ...VMP502 V 02 25 10 2019 8 Velleman nv Programming C Programming Python Programming...

Страница 9: ...V 02 25 10 2019 9 Velleman nv 6 3 Flowing LEDs We will see how to make eight LEDs blink in various effects Required Hardware 1 x Raspberry Pi 1 x breadboard 8 x LED 8 x 220 resistor jumper wires as n...

Страница 10: ...ome pi IDUINO_SuperKit_C_code_for_RaspberryPi 03_8Led 2 Compile gcc 8Led c o 8Led lwiringPi 3 Run sudo 8Led Python Programming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_RaspberryPi...

Страница 11: ...VMP502 V 02 25 10 2019 11 Velleman nv Programming C Programming...

Страница 12: ...ern 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 that the signal spends off The duration of the on time is called th...

Страница 13: ...Velleman nv A 60 duty cycle means the signal is on 60 of the time but off for 40 of the time The on time for a 60 duty cycle could be a fraction of a second a day or even week depending on the length...

Страница 14: ...rogramming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_RaspberryPi 2 Run sudo python 04_PwmLed py Press ENTER and you will see a gradual change of the LED luminance Through this expe...

Страница 15: ...breadboard 1 x RGB LED 3 x 220 resistor jumper wires as needed RGB LEDs emit light in various colours They package three LEDs of red green and blue into a transparent or semi transparent plastic shel...

Страница 16: ...cathode type In this experiment the latter is used Experiment C Programming 1 Change directory cd home pi IDUINO_SuperKit_C_code_for_RaspberryPi 05_RGB 2 Compile gcc rgb c o rgb lwiringPi lpthread 3 R...

Страница 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...

Страница 19: ...ive buzzer does not have an oscillating source and will not buzz if DC signals are used Instead you need to use square waves whose frequency is between 2K and 5K to drive it The active buzzer is often...

Страница 20: ...Pi 06_Beep 2 Compile gcc beep c o beep lwiringPi 3 Run sudo beep Python Programming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_RaspberryPi 2 Run sudo python 06_beep py You should th...

Страница 21: ...VMP502 V 02 25 10 2019 21 Velleman nv Programming C Programming Python Programming...

Страница 22: ...1 x Raspberry Pi 1 x breadboard 4 x jumper wire male to male 2 x red and 2 x black 1 x network cable or USB wireless network adapter 1 x IR receiver module 1 x IR remote controller 1 x 3 pin anti rev...

Страница 23: ...VMP502 V 02 25 10 2019 23 Velleman nv Experiment The LED on the module will be blinking Programming C Programming...

Страница 24: ...P502 V 02 25 10 2019 24 Velleman nv Python Programming 6 8 555 Timer Required Hardware 1 x Raspberry Pi 1 x breadboard 1 x NE555 3 x resistor 1 x 1 k 2 x 10 k 2 x 100 nF capacitor jumper wires as need...

Страница 25: ...modes Here the astable mode is used to generate square waves Under the astable mode the frequency of the output waveform of the 555 timer is defined by R1 R2 and In the above circuit R1 R2 10 k 100 nF...

Страница 26: ...amming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_RaspberryPi 2 Run sudo python 09_timer555 py You should see data on the display which are square waves generated by the 555 timer T...

Страница 27: ...VMP502 V 02 25 10 2019 27 Velleman nv Programming C Programming Python Programming...

Страница 28: ...95 8 x LED 3 x 220 resistor jumper wires as needed The 74HC595 is a silicon CMOS device which has an 8 bit shift register and a memory with three state output function Compatible with low voltage TTL...

Страница 29: ...ogramming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_RaspberryPi 2 Run sudo python 10_74HC595_LED py You should see eight LEDs blinking regularly Here three Raspberry Pi GPIOs are u...

Страница 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...

Страница 33: ...orized into two types a common cathode and a common anode depending on the different light emitting diode connections They are widely used in electronic appliances especially home appliances such as a...

Страница 34: ...nt1 lwiringPi 3 Run sudo segment1 Python Programming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_RaspberryPi 2 Run sudo python 11_segment py You should see the 7 segment display cycl...

Страница 35: ...wiringPi 2 Run sudo dice You should see numbers between 0 and 6 flashing quickly Press the button on the breadboard and the display will display a random number between 0 and 6 for 2 seconds and then...

Страница 36: ...VMP502 V 02 25 10 2019 36 Velleman nv Python Programming...

Страница 37: ...VMP502 V 02 25 10 2019 37 Velleman nv 6 11 Driving a Dot Matrix by 74HC595 Required Hardware 1 x Raspberry Pi 1 x breadboard 2 x 74HC595 1 x dot matrix jumper wires as needed...

Страница 38: ...4 8 12 1 7 2 5 The 8 x 8 dot matrix is made up of 64 LEDs each LED is placed at the cross point of a row and a column When the electrical level of a certain row is high and the electrical level of a c...

Страница 39: ...perKit_C_code_for_RaspberryPi 12_DotMatrix 2 Compile gcc dotMatrix c o dotMatrix lwiringPi 3 Run sudo dotMatrix Python Programming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_Raspber...

Страница 40: ...VMP502 V 02 25 10 2019 40 Velleman nv...

Страница 41: ...VMP502 V 02 25 10 2019 41 Velleman nv Python Programming...

Страница 42: ...hen connected to ground You can connect a 10K potentiometer to adjust its contrast when using the LCD1602 Pin 4 RS Selects the data register when supplied with high level 1 and instruction register wh...

Страница 43: ...de_for_RaspberryPi 13_LCD1602 2 Compile gcc lcd1602_2 c o lcd1602_2 lwiringPi 3 Run sudo lcd1602_2 Python Programming 1 Change directory cd home pi IDUINO_SuperKit_Python_code_for_RaspberryPi 2 Run su...

Страница 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...

Страница 50: ...is product and the latest version of this manual please visit our website www velleman eu The information in this manual is subject to change without prior notice COPYRIGHT NOTICE The copyright to thi...

Страница 51: ...shocks falls dust dirt humidity and by the article as well as its contents e g data loss compensation for loss of profits consumable goods parts or accessories that are subject to an aging process du...

Отзывы: