SunFounder PiDog Kit, Release 1.0
Actions:
Sound Effect:
1.stand
16.angry
2.sit
17.confused_1
3.lie
18.confused_2
4.lie_with_hands_out
19.confused_3
5.trot
20.growl_1
6.forward
21.growl_2
7.backward
22.howling
8.turn_left
23.pant
9.turn_right
24.single_bark_1
10.doze_off
25.single_bark_2
11.stretch
26.snoring
12.pushup
27.woohoo
13.shake_head
14.tilting_head
15.wag_tail
Run the Code
cd
/
home
/
pi
/
pidog
/
examples
sudo python3
2
_function_demonstration
.
py
After running this example, you input
1
and press
ENTER
, PiDog will stand; input
2
, PiDog will sit down; input
27
,
PiDog will issue “woohoo~ “.
Press
Ctrl+C
to exit the program.
Code
Note:
You can
Modify/Reset/Copy/Run/Stop
the code below. But before that, you need to go to source code path
like
pidog\examples
. After modifying the code, you can run it directly to see the effect.
#!/usr/bin/env python3
from
time
import
sleep
from
pidog
import
Pidog
import
os
my_dog
=
Pidog()
sleep(
0.5
)
actions
=
[
# name, head_pitch_adjust, speed
[
'stand'
,
0
,
50
],
[
'sit'
,
-
30
,
50
],
[
'lie'
,
0
,
20
],
[
'lie_with_hands_out'
,
0
,
20
],
[
'trot'
,
0
,
95
],
[
'forward'
,
0
,
98
],
[
'backward'
,
0
,
98
],
[
'turn_left'
,
0
,
98
],
[
'turn_right'
,
0
,
98
],
[
'doze_off'
,
-
30
,
90
],
[
'stretch'
,
30
,
20
],
[
'pushup'
,
-
30
,
50
],
(continues on next page)
2.2. Funny Project
49
Содержание PiDog
Страница 1: ...SunFounder PiDog Kit Release 1 0 sunfounder Jan 09 2023 ...
Страница 2: ......
Страница 4: ...ii ...
Страница 6: ...SunFounder PiDog Kit Release 1 0 Content 2 CONTENTS ...
Страница 8: ...SunFounder PiDog Kit Release 1 0 4 Chapter 1 Component List and Assembly Instructions ...
Страница 15: ...SunFounder PiDog Kit Release 1 0 Step 7 Click the WRITE button 2 1 Quick Guide on Python 11 ...
Страница 92: ...SunFounder PiDog Kit Release 1 0 88 Chapter 2 Play with Python ...
Страница 108: ...SunFounder PiDog Kit Release 1 0 104 Chapter 4 Appendix ...