How To Write Commands To A Serial Port Using Nodejs?
Good day everyone, I am having issues writing commands to a lock connected to a USB controller which is connected to the laptop port using NodeJs. I have successfully achieved this
Solution 1:
If you look in the SerialPort docs you'll see that the port is immediately opened when a new instance is instantiated, unless you pass the option AutoOn=false. So, in your case, the port is already open by the time you set the listener .on('open'), so it never receives an event. Remove the listener and just call .write() immediately.
Post a Comment for "How To Write Commands To A Serial Port Using Nodejs?"