I have been online for such a long time now and I really can't seem to find a working option. My plan is to run a program on BrickPi3 using Python which is very simple - move the robot forward when pressing 'w', stop it when 's' is pressed. I'm new to BrickPi3 and this is just to test. I know this isn't the BrickPi forum, but the problem is about Python and actually doesn't have anything to do with Python. So this is my program:
Code: Select all
import brickpi3
from time import sleep
import keyboard
BP = brickpi3.BrickPi3()
speed = 50
while True:
if keyboard.is_pressed('w'):
BP.set_motor_power(BP.PORT_B + BP.PORT_C, speed)
if keyboard.is_pressed('s'):
BP.set_motor_power(BP.PORT_B + BP.PORT_C, 0)Code: Select all
sudo pip3 install keyboardCode: Select all
sudo python motor_test.pyThank you very much!