SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
How it works?
We defined a
color_set()
function to let the three primary colors work together.
At present, pixels in computer hardware usually adopt a 24-bit representation method. The three primary colors are
divided into 8 bits, and the color value range is 0 to 255. With 256 possible values for each of the three primary colors
(don’t forget to count 0!), that 256 x 256 x 256 = 16,777,216 colors can be combined in this way. The
color_set()
function also follows the 24-bit notation, which makes it easier for us to select the desired color.
And since the value range of
duty_u16()
is 0~65535 (instead of 0 to 255) when the output signals to RGB LED
through PWM, we have defined
color_to_duty()
and
interval_mapping ()
function to map the color
values to the duty values.
3.4.10 Custom Tone
We have used active buzzer in the previous lesson, this time we will use passive buzzer.
Like the active buzzer, the passive buzzer also uses the phenomenon of electromagnetic induction to work. The
difference is that a passive buzzer does not have oscillating source, so it will not beep if DC signals are used. But this
allows the passive buzzer to adjust its own oscillation frequency and can emit different notes such as “doh, re, mi, fa,
sol, la, ti”.
Let the passive buzzer emit a melody!
Wiring
Two buzzers are included in the kit, we use the one with exposed PCB behind.
The buzzer needs a transistor to work, and here we use S8050.
82
Chapter 3. For MicroPython User
Summary of Contents for Thales Kit
Page 1: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 Jimmy SunFounder Jun 04 2021 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 CONTENTS ...
Page 140: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 136 Chapter 3 For MicroPython User ...
Page 164: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 160 Chapter 4 For Arduino User ...