Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tootallnate/ina260
https://github.com/tootallnate/ina260
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/tootallnate/ina260
- Owner: TooTallNate
- Created: 2022-05-29T18:20:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-03T06:04:31.000Z (over 2 years ago)
- Last Synced: 2024-10-24T02:44:24.245Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
@tootallnate/ina260
===================
### Read values from the INA260 bi-directional current and power monitorThis Node.js module reads values from the [Adafruit INA260 High or Low Side Voltage, Current, Power Sensor](https://www.adafruit.com/product/4226) over the I2C bus on a Raspberry Pi.
## Example
```typescript
import * as i2c from 'i2c-bus';
import { INA260 } from '@tootallnate/ina260';const bus = i2c.openSync(1);
const ina260 = new INA260(bus);while (true) {
const [voltage, current, power] = await Promise.all([
ina260.readVoltage(),
ina260.readCurrent(),
ina260.readPower(),
]);
console.log({ voltage, current, power });// Sleep for 1 second
await new Promise((r) => setTimeout(r, 1000));
}
```