Hi, I’m trying to control to control a mega pi through a raspberry pi via python.
I’m trying to activate the encoder motors from the raspberry pi so I can setup a websocket server where it listens to and then use that as a control panel, but the the motors never activate.
I have already updated the firmware, it works via the bluetooth from my phone.
Its connected via the included jumper thingy (the black rectangle that you put on the raspberry pi pins and into the bottom of the mega pi), but i have also tried it via a usb cable with the same results
In the rpi i have this python script atm
i run it via sudo python3 filename.py
non sudo has the same results
from megapi import *
def onForwardFinish(slot):
sleep(0.4);
print("test2")
bot.encoderMotorMove(slot,100,-1000,onBackwardFinish);
def onBackwardFinish(slot):
sleep(0.4);
print("slot")
bot.encoderMotorMove(slot,100,1000,onForwardFinish);
if __name__ == '__main__':
bot = MegaPi()
bot.start()
print("test")
bot.encoderMotorRun(3,0);
sleep(1);
onForwardFinish(3);
while 1:
continue;
and it outputs this
[GCC 8.3.0]
init MegaPi
<megapi_python3.mSerial object at 0x76128db0>
test
test2