# megabit

> Connect real things with Node.js

Latest version **1.0.1** (published 2021-09-04) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install megabit
pnpm add megabit
yarn add megabit
bun add megabit
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-09-04 |
| First published | 2020-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 15 |
| Unpacked size | 42.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kohei Watanabe |
| Maintainers | kou029w |
| Keywords | gpio, hardware, i2c, iot, linux, pi, raspberry pi, raspberry, raspi, robot, robotics, robots, rpi, smbus |

## Links

- npm: https://www.npmjs.com/package/megabit
- Repository: https://github.com/kou029w/megabit
- Homepage: https://github.com/kou029w/megabit#readme
- Issues: https://github.com/kou029w/megabit/issues
- npm.io page: https://npm.io/package/megabit

## Dependencies (15)

- [node-web-i2c](https://npm.io/package/node-web-i2c.md) ~1
- [node-web-gpio](https://npm.io/package/node-web-gpio.md) ~1
- [@chirimen/sht30](https://npm.io/package/@chirimen/sht30.md) ~1
- [@chirimen/s11059](https://npm.io/package/@chirimen/s11059.md) ~1
- [@chirimen/ads1015](https://npm.io/package/@chirimen/ads1015.md) ~1
- [@chirimen/adt7410](https://npm.io/package/@chirimen/adt7410.md) ~1
- [@chirimen/pca9685](https://npm.io/package/@chirimen/pca9685.md) ~1
- [@chirimen/vl53l0x](https://npm.io/package/@chirimen/vl53l0x.md) ~1
- [@chirimen/gp2y0e03](https://npm.io/package/@chirimen/gp2y0e03.md) ~1
- [@chirimen/veml6070](https://npm.io/package/@chirimen/veml6070.md) ~1
- [@chirimen/grove-light](https://npm.io/package/@chirimen/grove-light.md) ~1
- [@chirimen/grove-touch](https://npm.io/package/@chirimen/grove-touch.md) ~1
- [@chirimen/grove-gesture](https://npm.io/package/@chirimen/grove-gesture.md) ~1
- [@chirimen/grove-oled-display](https://npm.io/package/@chirimen/grove-oled-display.md) ~1
- [@chirimen/grove-accelerometer](https://npm.io/package/@chirimen/grove-accelerometer.md) ~1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-09-04
- 1.0.0-alpha.2 (next) — 2020-02-07
- 1.0.0 — 2021-07-24
- 1.0.0-beta.1 — 2021-07-24
- 1.0.0-beta.0 — 2021-07-24
- 1.0.0-alpha.1 — 2020-02-07
- 1.0.0-alpha.0 — 2020-02-07

## README

# Megabit

Connect real things with Node.js

## Usage

### GPIO Example

```js
const { gpio } = require("megabit");
const sleep = require("util").promisify(setTimeout);

async function blink() {
  for (;;) {
    await gpio(26).write(1);
    await sleep(1000);
    await gpio(26).write(0);
    await sleep(1000);
  }
}

blink();
```

### I<sup>2</sup>C Example

```js
const { sht30 } = require("megabit");

async function measure() {
  const { humidity, temperature } = await sht30().read();
  console.log(`Humidity: ${humidity.toFixed(2)} %`);
  console.log(`Temperature: ${temperature.toFixed(2)} ℃`);
}

measure();
```

## Documents

[Megabit API Documentation](https://kou029w.github.io/megabit/)

## Devices

| Device   | Description                                  | API                                                                 |
| -------- | -------------------------------------------- | ------------------------------------------------------------------- |
| ADS1015  | 12-bit Precision Analog to Digital Converter | [ads1015](https://kou029w.github.io/megabit/modules/ads1015.html)   |
| ADT7410  | High Accuracy Digital Temperature Sensor     | [adt7410](https://kou029w.github.io/megabit/modules/adt7410.html)   |
| ADXL345  | 3-axis Accelerometer                         | [adxl345](https://kou029w.github.io/megabit/modules/adxl345.html)   |
| GP2Y0E03 | 4-50 cm Distance Sensor                      | [gp2y0e03](https://kou029w.github.io/megabit/modules/gp2y0e03.html) |
| MPR121   | Proximity Capacitive Touch Sensor Controller | [mpr121](https://kou029w.github.io/megabit/modules/mpr121.html)     |
| PAJ7620  | Gesture Recognition Sensor                   | [paj7620](https://kou029w.github.io/megabit/modules/paj7620.html)   |
| PCA9685  | 16-Channel 12-Bit PWM/Servo Driver           | [pca9685](https://kou029w.github.io/megabit/modules/pca9685.html)   |
| S11059   | Color Sensor                                 | [s11059](https://kou029w.github.io/megabit/modules/s11059.html)     |
| SHT30    | Humidity and Temperature Sensor              | [sht30](https://kou029w.github.io/megabit/modules/sht30.html)       |
| SSD1306  | 128x64 Dot Matrix OLED                       | [ssd1306](https://kou029w.github.io/megabit/modules/ssd1306.html)   |
| SSD1308  | 128x64 Dot Matrix OLED                       | [ssd1308](https://kou029w.github.io/megabit/modules/ssd1308.html)   |
| TSL2561  | Ambient Light Sensor                         | [tsl2561](https://kou029w.github.io/megabit/modules/tsl2561.html)   |
| VEML6070 | UV(A) Light Sensor                           | [veml6070](https://kou029w.github.io/megabit/modules/veml6070.html) |
| VL53L0X  | Time of Flight Distance Sensor               | [vl53l0x](https://kou029w.github.io/megabit/modules/vl53l0x.html)   |

---
_Source: https://npm.io/package/megabit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
