npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ads1015

v1.0.0

Published

A Node.js library for an ads1015 analog to digital converter

Downloads

4

Readme

ADS1015

A Node.js library for an ADS1015 analog to digital converter

Theses are super inexpensive on amazon! ads1015 ads1015

An ads1115 converting joystick input and displaying on an ssd1327 (Converting analog joystick input and displaying on an ssd1327) The joystick is: here The display is: here   --> Also checkout my node module for it!: here

// const connection = [1, 0x48, 'i2c-bus']
//  use an `i2cdriver` board for development!...
const connection = ['/dev/tty.usbserial-DO010000', 0x48, 'i2cdriver/i2c-bus']

ADS1015.open(...connection).then(async (ads1015) => {
  ads1015.gain = 1

  for (let i = 0; i < 1000; i++) {
    let x = await ads1015.measure('0+GND')
    let y = await ads1015.measure('1+GND')
    console.log(x, y)
  }
})

Or, use with an existing bus instance:

const ADS1015 = require('ads1015')

const i2c = require('i2c-bus')
i2c.openPromisified(1).then(async (bus) => {
  const ads1015 = await ADS1015(bus)
  // ads1015.gain = 1

  for (let i = 0; i < 1000; i++) {
    let value = await ads1015.measure('0+GND')
    console.log(value)
  }
})

Install

https://npmjs.com/package/ads1015

npm install ads1015 i2c-bus

*i2c-bus not included in dependencies

To prevent multiple instances of i2c-bus being installed in your project- it is NOT included as a dependency. You just need to install it separately.

This also allows you to swap in a different bus, such as an i2cdriver if desired.

API

ADS1015(bus, addr = 0x48)

Creates an ADS1015 instance using and existing bus object.

ADS1015.open(busNum, addr = 0x48, provider = 'i2c-bus')

Opens an i2c bus and creates a new ads1015 instance.

busNum - The bus to open addr - The address of the ads1015 device provider - The i2c module to use to open the bus. (default i2c-bus)    The module must conform to the i2c-bus@^5.0.0 interface.    TIP! Try an i2cdriver for development!

ads1015.gain

Gets or sets the gain. You can use a Number or String.

Valid values: 2/3 = +/- 6.144V (default) 1 = +/- 4.096V 2 = +/- 2.048V 4 = +/- 1.024V 8 = +/- 0.512V 16 = +/- 0.256V

ads1015.measure(mux)

Requests a single measurement.

Valid values for mux parameter: '0+1' = Differential measurement between A0 & A1 '0+3' = Differential measurement between A0 & A3 '1+3' = Differential measurement between A1 & A3 '2+3' = Differential measurement between A2 & A3 '0+GND' = Single-ended measurement on A0 '1+GND' = Single-ended measurement on A1 '2+GND' = Single-ended measurement on A2 '3+GND' = Single-ended measurement on A3

License

MIT