Last active
November 2, 2017 05:11
-
-
Save WayneKeenan/f0c60d80bbaac9962a2e63bb7e850115 to your computer and use it in GitHub Desktop.
PiCraftZero test script, demoing self install of its 2 dependancies for PiratePython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pip | |
pip.main(['install', 'gpiozero']) | |
pip.main(['install', 'picraftzero']) # Joypad and Web Remote controls with multiple camera support, please see | |
# https://github.com/WayneKeenan/picraftzero | |
from picraftzero import Joystick, Wheelbase, steering_mixer, start | |
# Joystick axis range is: (left/down) -100 .. 100 (right/up) | |
# Motors value range is: (full speed backwards) -100 .. 100 (full speed forwards) | |
joystick = Joystick() # use the first available controller (e.g. Rock Candy, XBox360) or web client | |
motors = Wheelbase(left=1, right=0) # left,right = logical id of i2c motor (auto-detected Explorer pHAT or PiConZero) | |
# Connect the motor speeds (left, right) to the joysticks axes (x,y), via a 'steering mixer' | |
motors.source = steering_mixer(joystick.values) | |
start() # starts background threads, such as the HTTP server for the hosted web gui. | |
# Point your browser at http://raspberrypi.local:8000/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment