Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/jmschrack/atlas-scientific-i2c-nodejs
- Owner: jmschrack
- Created: 2021-09-19T01:14:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-18T17:12:28.000Z (almost 2 years ago)
- Last Synced: 2024-11-08T20:48:51.282Z (about 1 month ago)
- Topics: atlas-scientific, atlas-scientific-circuits, ezo, i2c-bus, nodejs
- Language: JavaScript
- Homepage:
- Size: 41 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)