EasyManua.ls Logo

SunFounder PiDog - Page 53

Default Icon
109 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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

Related product manuals