daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Oct 23rd, 2018 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const SerialPort = require('serialport')
  2. const Readline = require('@serialport/parser-readline')
  3. var port = new SerialPort('/dev/ttyUSB0', {
  4.   baudRate: 115200
  5. });
  6. const parser = port.pipe(new Readline({ delimiter: '\r\n' }))
  7. parser.on('data', (data) => {
  8. console.log(JSON.parse(data));
  9. })
  10.  
  11.  
  12. { data:
  13.    { gps: { status: 'found', lat: -1, lng: -1, time: '2080-1-5T23-59-47' },
  14.      sensors:
  15.       { temperature: 27.46,
  16.         pressure: 1000.4,
  17.         humidity: 45.242,
  18.         gasResistance: 53.75,
  19.         altitude: 107.707 } } }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top