The HP03S is a pressure and temperature module with:
Use the HP03S module for it.
You need an SO-xx adapter if you want to use it with a breadboard.
You can use any I2C port, e.g. I2C1. Additionally a simple output pin and one pwm pin are required.
Device Pin | Espruino e.g. Wifi | Description |
---|---|---|
1 SCL | B8 I2C1 SCL | |
2 SDA | B9 I2C1 SDA | Don\'t forget I²C pullup |
3 XCLR | B0 | Any Espruino output pin |
4 MCLK | B7 PWM | pwm pin - internal clock for the AD-converter |
5 VDD | 3.3 | |
6 VSS | GND |
Important Notices from the datasheet: Never unplug the module when power is on.
I2C1.setup( { scl: B6, sda: B7 } );
var hp03s = require('HP03S').connect( { i2c: I2C1, mclk: B4, xclr: B5 } );
I2C1.setup( { scl: B6, sda: B7 } );
var hp03s = require('HP03S').connect( { i2c: I2C1, mclk: B4, xclr: B5 } );
hp03s.getPressure( function( pressure, temperature ) {
console.log( "Pressure = " + pressure + " Pa" );
console.log( "Temperature = " + temperature + " °C" );
} );
You can only start a new measurement when a previous measurement is completed.
exports.connect = function (option, onReady) { ... }
/* Read the pressure in Pa and the temperature in °C from the sensor
* @param callback with parameters pressure {number} and temperature {number}
*/
HP03S.prototype.getPressure = function (callback) { ... }
/* Trigger one measurement (either pressure or temperature)
* @param pressureOrTemperatureCommand select pressure or temperature measurement: 0xf0 → measure pressure, 0xe8 → measure temperature
* @param completed called when result is available
*/
HP03S.prototype.measure = function (pressureOrTemperatureCommand, completed) { ... }
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.