SunFounder PiCrawler Kit
(continued from previous page)
if key in ('1234'):
leg = int(key) - 1
show_info()
# move
elif key in ('wsadrf'):
if 'w' == key:
coordinate[leg][1]=coordinate[leg][1] + step
elif 's' == key:
coordinate[leg][1]=coordinate[leg][1] - step
elif 'a' == key:
coordinate[leg][0]=coordinate[leg][0] - step
elif 'd' == key:
coordinate[leg][0]=coordinate[leg][0] + step
elif 'r' == key:
coordinate[leg][2]=coordinate[leg][2] + step
elif 'f' == key:
coordinate[leg][2]=coordinate[leg][2] - step
crawler.do_single_leg(leg,coordinate[leg],speed)
sleep(0.1)
# coordinate=crawler.current_step_all_leg_value()
show_info()
sleep(0.05)
if __name__ == "__main__":
main()
• current_step_all_leg_value(): Returns the coordinate values of all legs.
• do_single_leg(leg,coordinate[leg],speed): Modify the coordinate value of a certain leg individually.
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 [] and join today!
74 Chapter 3. Play with Python