Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pb with serialport #3

Closed
SebCanet opened this issue Feb 27, 2019 · 6 comments
Closed

Pb with serialport #3

SebCanet opened this issue Feb 27, 2019 · 6 comments

Comments

@SebCanet
Copy link

It seems that serial port vesion different than v4.07 does not work properly...
Serial console does not do anything.
Trying with other versions....

@SebCanet
Copy link
Author

For connect button and [email protected], I need to change like this:

document.getElementById('btn_connect').onclick = function(event) {
		var SerialPort = require("serialport")
		var Readline = require('@serialport/parser-readline')
		var moniteur = document.getElementById('fenetre_term')
		var vit = document.getElementById('vitesse').value
		var baud = parseInt(vit)
		var _com = localStorage.getItem("com")
		s_p = new SerialPort(_com,{baudRate:baud})
		var parser = s_p.pipe(new Readline({ delimiter: '\r\n' }))
		document.getElementById('btn_connect').disabled=true
		document.getElementById('btn_envoi').disabled=false
		s_p.on('open', function(){
			moniteur.innerHTML += ' démarrage de la communication série<br />'
		})
		parser.on('data', function(data){
			moniteur.innerHTML += data + "<br />"
			moniteur.scrollTop = moniteur.scrollHeight;
			moniteur.animate({scrollTop: moniteur.scrollHeight})
		})
	}

@SebCanet SebCanet mentioned this issue Mar 25, 2019
@fontainejp
Copy link
Owner

Thanks for your help.
i don't know why serialport don't work for you.
For me it's ok whatever the version.
A new version is available with all node modules updated ([email protected])

@SebCanet
Copy link
Author

Serialport v4.0.7 cannot download...just typing "npm install" and npm blocks on it.
And with v7.1.4 your script term.js cannot read and writefrom serialport. I'll test your new version on different Windows vesion.

@SebCanet
Copy link
Author

With the v7.1.4 there's still the same pb, on different Windows version. This version seems to need more parameters to open connection.
Even your v1.3.1 has a bug.
Many thanks for your help.

@fontainejp
Copy link
Owner

Hi, i think its Ok

  • var parser = s_p.pipe(new Readline({ delimiter: '\r\n' })) was at the wrong place
  • isOpen is now a property
    You can test the latest version (1.3.2)

@SebCanet
Copy link
Author

Great!!!! It works !
Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants