SunFounder PiDog Kit, Release 1.0
2.3.9 PiDog RGB Strip
There is an RGB Strip on PiDog’s chest, which PiDog can use to express emotions.
You can call the following function to control it.
Pidog
.
rgb_strip
.
set_mode(style
=
'breath'
, color
=
'white'
, brightness
=
1
, delay
=
0.01
)
•
style
: The lighting display mode of RGB Strip, the following are its available values.
–
breath
–
boom
–
bark
•
color
: The lights of the RGB Strip show the colors. You can enter 16-bit RGB values, such as
#a10a0a
, or
the following color names.
–
"white"
–
"black"
–
"white"
–
"red"
–
"yellow"
–
"green"
–
"blue"
–
"cyan"
–
"magenta"
–
"pink"
•
brightness
: RGB Strip lights display brightness, you can enter a floating-point value from 0 to 1, such as
0.5
.
•
delay
: Float, display animation speed, the smaller the value, the faster the change.
Use the following statement to disable RGB Striping.
Pidog
.
rgb_strip
.
close()
Here are examples of their use:
from
pidog
import
Pidog
import
time
my_dog
=
Pidog()
while
True
:
# style="breath", color="pink"
my_dog
.
rgb_strip
.
set_mode(style
=
"breath"
, color
=
'pink'
)
time
.
sleep(
3
)
# style:"boom", color="#a10a0a"
my_dog
.
rgb_strip
.
set_mode(style
=
"bark"
, color
=
"#a10a0a"
)
time
.
sleep(
3
)
(continues on next page)
84
Chapter 2. Play with Python
Summary of Contents for PiDog
Page 1: ...SunFounder PiDog Kit Release 1 0 sunfounder Jan 09 2023 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder PiDog Kit Release 1 0 Content 2 CONTENTS ...
Page 8: ...SunFounder PiDog Kit Release 1 0 4 Chapter 1 Component List and Assembly Instructions ...
Page 15: ...SunFounder PiDog Kit Release 1 0 Step 7 Click the WRITE button 2 1 Quick Guide on Python 11 ...
Page 92: ...SunFounder PiDog Kit Release 1 0 88 Chapter 2 Play with Python ...
Page 108: ...SunFounder PiDog Kit Release 1 0 104 Chapter 4 Appendix ...