Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

259
Views
How to open Serial Port USB using Bonescript

I am new to bone script, I am trying to open serial USB port but I am getting error, here I have pasted my code , please check and verify the code, where I am doing mistakes.

var b = require('bonescript');
var port1='/dev/ttyUSB0';
var port2='/dev/ttyUSB2';

var options={
    baudrate: 9600,
    parity: 'even',
   // parser: b.serialParsers.readline("\n")
};
console.log(b.serialOpen(port1, options, onSerial1));// open port 1
console.log(b.serialOpen(port2, options, onSerial2));//open port 2
b.serialWrite(port1,'A');//start letter bouncing
function onSerial1(x){
     if (x.event == 'data') {
        console.log(x.data);
        var char =x.data;//get letter
        if(char=='Z')
        char='A';// reset or incremet
        else
        char++;
        b.serialWrite(port2,char);
    }
}
function onSerial2(x){
     if (x.event == 'data') {
        console.log(x.data);
        var char =x.data;
        if(char=='Z')
        char='A';
        else
        char+=1;
        b.serialWrite(port1,char);
    }
}

And I am getting error as follow

/usr/local/lib/node_modules/bonescript/src/serial.js:16
    if (m.ports[args.port].path) path = m.ports[args.port].path;
                           ^

TypeError: Cannot read property 'path' of undefined
    at Object.m.doOpen (/usr/local/lib/node_modules/bonescript/src/serial.js:16:28)
Waiting for the debugger to disconnect...
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!