我使用USB將Arduino連接到我的筆記本電腦,並且可以使用Processing讀取串行數據。如何從JavaScript讀取串行端口數據
有什麼辦法可以將這些數據實時獲取到本地瀏覽器中嗎?例如,顯示串口值的文本字段?它不必連接到互聯網。
Processing版本的JavaScript不支持以下代碼,這將是理想的解決方案。
處理代碼爲:
myPort = new Serial(this, Serial.list()[0], 9600);
// read a byte from the serial port
int inByte = myPort.read();
// print it
println(inByte);
// now send this value somewhere...?
// ehm...
你應該看看這個:https://github.com/rwaldron/johnny-five。也許它可以幫助你。 – kmas