hegduinojs

1.0.0 • Public • Published

hegduino.js

Contains USB, BLE, and WiFi Event Source protocols to connect to the HEGduino devices. They all use the same calls, just specify which mode you want.

let heg = new hegduino('usb',ondata(newline)=>{},onconnect()=>{},ondisconnect=>{},hostURL);

// Fill out the ondata, onconnect, and ondisconnect functions to handle device events.

// newline will contain the string which you can then split.

heg.sendCommand('S'); //send a command to the device from any protocol.

heg.connect(); //runs the connect protocol based on the mode you set it up for.
heg.disconnect(); //disconnect from the device stream

In the code you can find a full BLE, Serial (for general web serial or chrome serial), and WiFi (event sources and xmlHTTPrequests) code demonstrations for working with the device in javascript.

It's fairly barebones, just barely evolved beyond some tutorials I followed, but you can update the device via BLE or WiFi if you dig into those APIs, and generally this is a simple way to get data for any protocol available.

By: Joshua Brewster License: MIT

Contributors: Diego Schmaedech (chrome serial)

Package Sidebar

Install

npm i hegduinojs

Weekly Downloads

0

Version

1.0.0

License

AGPL-3.0-or-later

Unpacked Size

72.4 kB

Total Files

5

Last publish

Collaborators

  • moothyknight