CO2 Monitor Connector for Node
This project is heavily influenced by dmage/co2mon, kdudkov/co2mon, vfilimonov/co2meter and could be considered as a port of co2mon
for Node.
Tested on Mini CO2 Monitor (MT8057s), Holtek Semiconductor, Inc. USB-zyTemp.
# npm
npm i co2mon
# yarn
yarn add co2mon
const { connect } = require('co2mon');
async function usingPromise() {
const { getCO2, disconnect } = connect();
const co2 = await getCO2();
console.log(co2);
disconnect();
}
function viaEvent() {
const { emitter, disconnect } = connect();
emitter.once('co2', (co2) => {
console.log(co2);
disconnect();
});
}
const { connect } = require('co2mon');
async function usingPromise() {
const { getTemperature, disconnect } = connect();
const temperature = await getTemperature();
console.log(temperature);
disconnect();
}
function viaEvent() {
const { emitter, disconnect } = connect();
emitter.once('temperature', (temperature) => {
console.log(temperature);
disconnect();
});
}