web java applet reads serial
in
Integration and Hardware
•
1 year ago
Hello,
I did create a processing java applet from "Library > Serial > SimpleRead exemple code" with some modifs (see bellow).
When I signed the applet, it works fine in Mozilla when I lunch the web page from index.html on local machine.
FF14 browser do shows the applet and it is working well with the serial input and output from keyPressed. (IE8 nor Chrome21 does)
Do not ask me please why I want to do it. I need it.
When I upload this whole applet directory on a remote server, it doesn't work.
Do any one has an advice what setting in browser or permission or other shall I solve to be able run it from remote server?
- import processing.serial.*;
- Serial myPort; // The serial port
- String message = "";
- char keyCmd;
- int lf = 10; // Linefeed in ASCII
- void setup() {
- size(300, 100);
- println(Serial.list());
- String portName = Serial.list()[1];
- myPort = new Serial(this, portName, 57600);
- }
- void draw() {
- background(0);
- text("portName: " + Serial.list()[1], 10, 15);
- text("BaudRate: " + 57600, 10, 30);
- text("Last Sent: " + keyCmd, 10, 45);
- text("Last Received: " + message, 10, 60);
- }
- void serialEvent(Serial myPort) {
- message = myPort.readStringUntil(lf);
- }
- void keyPressed() {
- myPort.write(key);
- keyCmd = key;
- }
1