SunFounder PiDog Kit, Release 1.0
from
pidog
import
Pidog
from
time
import
sleep
from
preset_actions
import
pant
from
preset_actions
import
body_twisting
my_dog
=
Pidog()
sleep(
0.5
)
def
wake_up
():
my_dog
.
rgb_strip
.
set_mode(
'breath'
, front_color
=
'yellow'
, brightness
=
0.8
, delay
=
0.095
)
my_dog
.
head_move([[
0
,
0
,
30
]]
*
2
, immediately
=
True
)
my_dog
.
do_action(
'stretch'
, wait
=
True
, speed
=
20
)
my_dog
.
wait_all_done()
sleep(
0.2
)
body_twisting(my_dog)
my_dog
.
wait_all_done()
sleep(
0.2
)
my_dog
.
head_move([[
0
,
0
,
-
30
]], immediately
=
True
, speed
=
90
)
my_dog
.
do_action(
'sit'
, wait
=
False
, speed
=
50
)
my_dog
.
wait_legs_done()
my_dog
.
do_action(
'wag_tail'
, step_count
=
10
, wait
=
False
, speed
=
100
)
my_dog
.
rgb_strip
.
set_mode(
'breath'
, front_color
=
[
245
,
10
,
10
], brightness
=
0.8
, delay
=
0.002
)
pant(my_dog, pitch_comp
=-
30
)
my_dog
.
wait_all_done()
my_dog
.
rgb_strip
.
close()
if
__name__
==
"__main__"
:
try
:
wake_up()
except
KeyboardInterrupt
:
pass
finally
:
my_dog
.
close()
2.2.3 Function Demonstration
This project shows you all of PiDog’s usual actions and sounds.
You can make PiDog make actions or make sounds by entering the serial number.
The motion/sound effects currently included in this example are listed below.
48
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 ...