Skip to content

Ultrasonic reading is not realtime #3

@kenken64

Description

@kenken64

could it be the makeblock mbot firmware for ultrasonic having performance issue ?

I did a comparison by just putting print(".."); to the onread python codes for lightsensor and linesensor it print out super fast but ultrasonic. Pls help

`
def __onRead(self,callback):
while 1:
if(self.exiting==True):
break
try:
if self.device.isOpen()==True:
n = self.device.inWaiting()
print("..");
for i in range(n):
r = ord(self.device.read())
callback(r)
sleep(0.01)
else:
sleep(0.5)
except Exception,ex:
print str(ex)
self.close()
sleep(1)

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions