I hit my head two times on this, getting serialdata via an Electron app, time to put the taken steps on paper.
I found this demo project and used it aswell: https://github.com/johnny-five-io/electron-serialport
I implemented some changes to push the data to a table.
The project code can be found on my github pagehttps://github.com/timdows/webpages/tree/master/ElectronSerial
Implementing serialport in an existing project
The installation is as easy as running the install command
[code]npm install –save-dev serialport[/code]
When trying to run electron I got:
According to the manual on github, it is needed to use electron-rebuild in order to solve this.
[code]npm install –save-dev electron-rebuild[/code]
Change package.json under the scripts section
run npm install, it will rebuild the serialport for us (takes a while on the Pi3)
A couple of weeks later I got this error ‘compiled against a different Node.js version’
Uncaught Error: The module 'xxx/serialport/build/Release/serialport.node' was compiled against a different Node.js version using
npm cache clear
rm -rf node_modules
12 thoughts on “Using Raspberry Pi3’s serialport via an Electron app”
I’m trying to install the above application to my raspberry pi B3, but after running npm start command its opening electron and showing some blank page and after that nothing is happening, but the same application is working fine my desktop. I installed all the packages still its not working, please help me out with this. And please brief me about the hardware connection part aswell.
Thanks in advance.
Comments are closed.