Lm2 and Lm3 ! port USB ? - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Lm2 and Lm3 ! port USB ? (/showthread.php?tid=413) |
Lm2 and Lm3 ! port USB ? - phongvucba - 06.10.2016 Hi everybody ! I have trouble following: Write a script to check the data via USB to the LM. ----------- require ('serial') if not ready then Ready = true port, err = serial.open ('/ dev / ttyUSB2') log (port, err) end ----------- On Lm2 will be announced: Lua serials @ / dev / ttyUSB2; baud: 115200; parity: none, data bits: 8, stop bits: 1, duplex: full, flow: none Such is the success! ----------- On LM3 will be announced: * Arg: 1 * luaserial * Arg: 2 * nil Such is successful or unsuccessful? Plug the device was still on the LM2 and LM3 is the same USB device RE: Lm2 and Lm3 ! port USB ? - admin - 06.10.2016 Your LM2 has older serial library, that's why the output is different. Anyway, if port cannot be open your port variable will be nil and err will be a string cannot open port RE: Lm2 and Lm3 ! port USB ? - phongvucba - 06.10.2016 Can you give me one script writes on the latest LM3? Script to check if USB ports are open yet? RE: Lm2 and Lm3 ! port USB ? - admin - 06.10.2016 Do you need to check if port is present in the system? Code: if io.exists('/dev/ttyUSB0') then RE: Lm2 and Lm3 ! port USB ? - phongvucba - 08.10.2016 good. Thank so much admin! |