This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Lm2 and Lm3 ! port USB ?
#1
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
Reply
#2
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
Reply
#3
Can you give me one script writes on the latest LM3?
Script to check if USB ports are open yet?
Reply
#4
Do you need to check if port is present in the system?
Code:
if io.exists('/dev/ttyUSB0') then
  alert('Port OK')
else
  alert('Port not found')
end
Reply
#5
good. Thank so much admin!
Reply


Forum Jump: