-
Notifications
You must be signed in to change notification settings - Fork 114
Implement reading from the serial port. Better error checking #3
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
Conversation
calling the error callback with a descriptive error message.
Implement reading from the serial port. Better error checking
|
So I merged and tried your code, but I can't read from the Arduino. Regards, Xavier |
|
Hello Xavier - je pense qu'on peut parler français :) J'ai uniquement testé avec un FTDI jusqu'ici, voici le code que
function onRead(readInfo) { Hoping this helps! Very stable for me, I tested this yesterday for more Ed On Sun, Mar 23, 2014 at 10:09 AM, Xavier Seignard
|
|
Salut, I found my problem, it doesn't work with my Arduino Leonardo, but I tested with an Arduino Pro Mini and it works, weird. Here is the snippet I used Merci de ton aide! a+ |
|
Perfect ! Glad it worked for you too. I'm using your plugin for a custom amateur radio transceiver controller, Ed On Sun, Mar 23, 2014 at 12:07 PM, Xavier Seignard
|
|
Even if it is open source? Btw, I still have some troubles with the decoding of the ArrayBuffer, I get some unreadable characters, I don't know if it comes from the cheap usb/serial converter I use, or from the way I translate the buffer to a string, hre is what I do: What's your technique? I tried to search on the source of node-serialport, but with no luck. And how do you send data from your device to Android? In Arduino I do a simple thing like this: Any idea? Regards, Xavier |
|
Open Source might be an option, but then I will get hate mail from quite Here is what I do in my code: same ab2str technique as yours, no issue My device is a Ham radio (elecraft KX3, look it up), which sends data on Ed On Sun, Mar 23, 2014 at 3:00 PM, Xavier Seignard
|
This PR implement reading from the serial port. This is a simple (unique) callback driven mechanism, so the javascript app will have to continuously re-poll the serial port after getting data or a timeout (buffer with length = 0). A better mechanism would be to trigger "onData" events.
Also, added more checks on the state of the serial port, so that in case a Cordova app attempts read/write/close operations on ports that were not previously opened, the app does not crash but calls the error callback.