New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

veml6070-sensor

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

veml6070-sensor

A Node.js I2C module for the Vishay Semiconductors VEML6070 UVA Light Sensor

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

veml6070-sensor

Node.js versions NPM version

Welcome to veml6070-sensor, a Node.js I2C module for the Vishay Semiconductors VEML6070 UVA Light Sensor. Adafruit sells a VEML6070 breakout board and here is the datasheet.

This module uses i2c-bus which should provide access with Node.js on Linux boards like the Raspberry Pi Zero, 1, 2, or 3, BeagleBone, BeagleBone Black, or Intel Edison.

Since veml6070-sensor needs to talk directly to the I2C bus and requires access to /dev/i2c, you will typically need run Node with elevated privileges or add your user account to the i2c group: $ sudo adduser $USER i2c

Example Code

const VEML6070 = require('veml6070-sensor');

// VEML6070 constructor options object is optional, i2cBusNo defaults to 1
//
const veml6070 = new VEML6070( {i2cBusNo : 1} );

const readSensorData = () => {
  veml6070.readSensorData()
    .then((data) => {
      console.log(`data = ${JSON.stringify(data, null, 2)}`);
      setTimeout(readSensorData, 1000);
    })
    .catch((err) => {
      console.log(`VEML6070 read error: ${err}`);
      setTimeout(readSensorData, 2000);
    });
};

// VEML6070 init options object is optional, integrationTime defaults to VEML6070.VEML6070_INTEGRATION_TIME_1_T()
//
veml6070.init({integrationTime : VEML6070.VEML6070_INTEGRATION_TIME_1_T()})
  .then((result) => readSensorData())
  .catch((err) => console.error(`VEML6070 init failed: ${err} `));

##Example Output

> sudo node example.js
data = {
  "uv": 3839
}

##Example Wiring

For an example of I2C setup on a Raspberry Pi, take a look at my pi-weather-station project.

Keywords

VEML6070

FAQs

Package last updated on 22 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts