This is an example of how to read the Calypso Ultrasonic wind sensor from nodejs.
Quick test:
npm install
node connect
Start searching for a calypso ultrasonic peripheral. The optional callback is only called if there is an error. See setDiscoveredCallback.
Stop searching for new devices.
Whenever a Calypso wind sensor is found, the callback gets called.
Searches only starts once scan() has been called.
The callback takes the form:
function(err, peripheral){}
See Noble's peripheral documentation. The peripheral object will have two calypso-specific methods, listenData() and calibrate().
Subscribe to wind sensor data stream.
The callback is:
function(err, sensorData)
Sensor data has the following fields:
Field | Units |
---|---|
aws | knots |
awa | degrees |
battery | percent |
temperature | Celsius degrees |
roll | degrees |
pitch | degrees |
heading | degrees |
Run the calibration procedure. See the calibration example
The callback has the following signature: cb(err)
. If err
is
undefined or null, calibration succeeded and was saved.