Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jmschrack/atlas-scientific-i2c-nodejs

NodeJS wrapper for Atlas Scientific devices using I2C
https://github.com/jmschrack/atlas-scientific-i2c-nodejs

atlas-scientific atlas-scientific-circuits ezo i2c-bus nodejs

Last synced: 17 days ago
JSON representation

NodeJS wrapper for Atlas Scientific devices using I2C

Awesome Lists containing this project

README

        

# Atlas Scientific I2C - EZO Device Wrappers

This is collection of wrapper classes which handle working with EZO Devices over I2C in NodeJS.

## Supported Devices

* pH
* Peristaltic Pump
* ORP
* EC
* DO

> Any device that responds properly to the info command, but it not in the supported list, will be instantiated as a generic EZO device

These were the only devices I had on hand to test with.

Pull Requests to support other devices are welcome!

# Install

This requires the PromisifiedBus class from i2c-bus
1. `npm install i2c-bus`
2. `npm install atlas-scientific-i2c`

# Getting Started

```
const as_dev=require('atlas-scientific-i2c');
const i2c = require('i2c-bus');

async function Test(){
//open the i2c bus
const bus = await i2c.openPromisified(1);
//find all EZO devices
const devs=await as_dev.FindAllDevices(bus);
//print out all detected devices
console.log(devs);
//Loop through the list, using 'instanceof' to find the pH chip, and pull a reading from it.
devs.forEach(async item=>{
if(item instanceof as_dev.pH){
const r = await item.GetReading();
console.log('pH reading:'+r);
}else{
//for everything else, print out the device's class
console.log(item.constructor.name);
}
});
}

Test();
```

# API

[JSDoc](api.md)