1.0.1 • Published 3 years ago

megabit v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Megabit

Connect real things with Node.js

Usage

GPIO Example

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();

I2C Example

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

Devices

DeviceDescriptionAPI
ADS101512-bit Precision Analog to Digital Converterads1015
ADT7410High Accuracy Digital Temperature Sensoradt7410
ADXL3453-axis Accelerometeradxl345
GP2Y0E034-50 cm Distance Sensorgp2y0e03
MPR121Proximity Capacitive Touch Sensor Controllermpr121
PAJ7620Gesture Recognition Sensorpaj7620
PCA968516-Channel 12-Bit PWM/Servo Driverpca9685
S11059Color Sensors11059
SHT30Humidity and Temperature Sensorsht30
SSD1306128x64 Dot Matrix OLEDssd1306
SSD1308128x64 Dot Matrix OLEDssd1308
TSL2561Ambient Light Sensortsl2561
VEML6070UV(A) Light Sensorveml6070
VL53L0XTime of Flight Distance Sensorvl53l0x