EasyManua.ls Logo

SunFounder PiSloth - Move

SunFounder PiSloth
113 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 pisloth
4.2 Move
This is the first project. PiSloth has woken up, and it moves freely.
Run the Code
cd /home/pi/pisloth/examples
sudo python3 move.py
After running the code, you will see PiSloth move left 7 steps, forward 5 steps, right 7 steps, and forward 5 steps.
Code
Note: You can Modify/Reset/Copy/Run/Stop the code below. But before that, you need to go to source code path
like pisloth\examples. After modifying the code, you can run it directly to see the effect.
from pisloth import Sloth
sloth = Sloth([1,2,3,4])
sloth.set_offset([0,0,0,0])
def main():
sloth.do_action('turn left', 7, 90)
sloth.do_action('forward', 5, 90)
sloth.do_action('turn right', 7, 90)
sloth.do_action('forward', 5, 90)
(continues on next page)
4.2. Move 79

Related product manuals