Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ultrasonic reading is not realtime #3

Open
kenken64 opened this issue Jul 23, 2016 · 0 comments
Open

Ultrasonic reading is not realtime #3

kenken64 opened this issue Jul 23, 2016 · 0 comments

Comments

@kenken64
Copy link

kenken64 commented Jul 23, 2016

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)

`

@kenken64 kenken64 reopened this Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant