Note
Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Why Join?
Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Learn & Share: Exchange tips and tutorials to enhance your skills.
Exclusive Previews: Get early access to new product announcements and sneak peeks.
Special Discounts: Enjoy exclusive discounts on our newest products.
Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
👉 Ready to explore and create with us? Click [here] and join today!
8. Push Up
PiDog is an exercise-loving robot that will do push-ups with you.
Run the Code
cd ~/pidog/examples
sudo python3 8_pushup.py
After the program runs, PiDog will perform a plank, then cycle through push-ups and barks.
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 pidog import Pidog
from time import sleep
from preset_actions import push_up, bark
my_dog = Pidog()
sleep(0.5)
def main():
my_dog.legs_move([[45, -25, -45, 25, 80, 70, -80, -70]], speed=50)
my_dog.head_move([[0, 0, -20]], speed=90)
my_dog.wait_all_done()
sleep(0.5)
bark(my_dog, [0, 0, -20])
sleep(0.1)
bark(my_dog, [0, 0, -20])
sleep(1)
my_dog.rgb_strip.set_mode("speak", color="blue", bps=2)
while True:
push_up(my_dog, speed=92)
bark(my_dog, [0, 0, -40])
sleep(0.4)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass
except Exception as e:
print(f"\033[31mERROR: {e}\033[m")
finally:
my_dog.close()