A couple of weeks ago I put together a process for allowing access to a hardware serial port from JavaScript. I thought I would point to the documentation page here and allow the comments section of this post to be a place where questions could be answered and so on.
Without further ado, here it is:
JavaScript Serial
Update: I can no longer maintain or provide any kind of support on this software.
hi, thanks for the nice piece of software!
is it possible to change the baudrate via javascript?
keep up the good work!
Hi Chris,
Yes, it is possible but I didn’t create any methods to do so. You will have to edit the source and compile.
The source is located here: http://www.walking-productions.com/jsserial/new/JSSerial.java
You’ll need the Serial.jar library from Processing.org as well.
-shawn
Hello,
I was trying your serial COM application at http://www.walking-productions.com/jsserial/new/JSSerial.html.
When I click ListPorts it tells me: 0:COM1, so in some way it is recognizing that there is a COM port.
Then I clicked in Examples:
OpenPort0
Start Loop : the text ‘Nothing Yet’ disappears but when I scan from the COM barcode nothing happens.
I have ensured that the scanner is returning data by using another testing application.
…am I doing something wrong?
Hi Clinton,
Not much I can tell you other than you’ll have to program an application that uses the JSSerial applet to work with the barcode scanner you are trying to use. I am sure it won’t work out of the box for that.
-shawn
Hi Shawn,
I would like to add the data rate control as well: I saw from your note that the serial.jar file is required, but I am not clear on how that is included – is there an additional ‘import’ required in JSSerial.java ?
Thks,
Bill
Hi Shawn,
Thanks for the applet, I am currently using it. However I’d like to know whether you came across an issue where somtimes, when you scan long barcodes, only part of the barcode is returned by the applet. For example, when scanning barcode with value 10060130554, only 554 is returned from the applet. Have any suggestions regarding this?
Thanks and regards
Clinton
Hi Clinton,
Sorry, have never tried to use this with a barcode scanner. I imagine that the source would have to be modified to work in the manner that the barcode scanner is sending out the data.
-s
Hello,
Now I’d like to connect to COM1 port through Javascript and your script helps a lot. I would like to know is there any way to set the handshake information? I check the data traffic from/to my COM1 and I found that data sent to the port when setting handshake information is not correct and it caused my web application to fail connecting to the port. Please advice and thank you very much for sharing your script and knowledge :D