Very laggy when reading data from device #507
-
I converted a NodeJS code. The NodeJS program is very fluid and I don't see any lagging when I am reading from the device. Here's the NodeJS code https://github.com/fpv-wtf/voc-poc/blob/master/index.js And here is my code. When I am using this reading from the same device, it is very laggy. What am I doing wrong?
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
Have you had any success solving your problem? I'm struggling with a stubborn time-out problem when I use the script you have provided above. Maybe unrelated, but I do not know. |
Beta Was this translation helpful? Give feedback.
-
You should use large amount of data and not one packet by packet. |
Beta Was this translation helpful? Give feedback.
-
I was going back and forth between using pyusb and pyserial because I could not get data transfers to work with either. Then, I stumbled on to a YouTube video https://www.youtube.com/watch?v=xc9rUI0F6Iw in which the creator was having the same problem as me... configuring the port went fine, but no data transfer. At specifically about 2 minutes 20 seconds into the video, the author explains what he found that made things work for him (and for me), specifically (i) force an Arduino reset by setting the DTR line low, (ii) waiting one second, (iii) flushing the Arduino input using the flushInput() command, and then finally (iv) setting the DTR line True. I found that the only serial port that would completely work on the Arduino is the ttyACM0 port; I still need to understand this better. I do not know (yet) if the same kind of thing was causing my pyusb efforts to fail or not. |
Beta Was this translation helpful? Give feedback.
-
Like this code? I changed the last parameter to 64000.
|
Beta Was this translation helpful? Give feedback.
You should use large amount of data and not one packet by packet.