fontainejp / blocklino

A mini development environment for free and open source graphic language
http://fontainejp.github.io
Creative Commons Zero v1.0 Universal
14 stars 9 forks source link

Pb with serialport #3

Closed SebCanet closed 5 years ago

SebCanet commented 5 years ago

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 commented 5 years ago

For connect button and serialport@7.1.4, 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})
        })
    }
fontainejp commented 5 years ago

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 (serialport@7.1.4)

SebCanet commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Hi, i think its Ok

SebCanet commented 5 years ago

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