I’m trying to control the Ultimate 2.0 robot via Raspberry Pi and Python. At first I tested the ports 1-4 with the encoder motor everything worked fine.
megapi import *
def onRead(v):
print(“distance:”+str(v)+" cm");
if name == ‘main’:
bot = MegaPi()
bot.start()
while 1:
sleep(0.1);
bot.ultrasonicSensorRead(8,onRead);
Now after running the example code for the ultrasonic sensor. I can hear the sensor working for some time. Then it stops and the following message appears:
“device reports readiness to read but returned no data (device disconnected or multiple access on port?)”