Skip to main content

Move Hexapod

Edit your Shield file:

main.py
import asyncio
from stemi.robot import Robot

robot = Robot()

async def main():
while True:
await robot.forward(50, 5)
await robot.right(50, 5)

if __name__ == "__main__":
asyncio.run(main())

This example will move robot for 5 seconds at 50% of maximum speed. It will then turn right for 5 seconds at 50% of maximum speed.

caution

This example uses asyncio. Asyncio is a library that allows user to write concurrent code using the async/await syntax. Without asyncio, code execution would not stop and wait for the code to execute.

Explore more robot methods