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 🙏

© 2026 – Pkg Stats / Ryan Hefner

npm-reterminal-dm

v1.1.2

Published

Access/ control reTerminal DM hardware such as accelerometer, light sensor, touch panel, buzzer, buttons, LEDs

Readme

npm-reterminal-dm

A Node.js package for accessing and controlling reTerminal DM hardware components including touch panel, buzzer, LEDs, and light sensor.

Installation

From npm

npm install npm-reterminal-dm --save

From Source

npm install https://github.com/cgjgh/npm-reterminal-dm

Available Hardware Components

  • Touch Panel: Multi-touch capacitive touchscreen
  • Buzzer: Built-in buzzer for audio feedback
  • LEDs: User-controllable LED (red)
  • Light Sensor: Ambient light intensity sensor

Usage

Touch Panel

Control and monitor the capacitive touch panel:

const InputEvent = require('npm-reterminal-dm');
const dev = require('npm-reterminal-dm/lib/deviceid');

const touch = new InputEvent.Touch(dev.tpPath());

// Listen for touch coordinates
touch.on('x-axis', function(coordinate) {
    console.log('X-axis coordinate: ' + coordinate);
});

touch.on('y-axis', function(coordinate) {
    console.log('Y-axis coordinate: ' + coordinate);
});

Buzzer Control

Control the built-in buzzer:

const buzz = require('npm-reterminal-dm/lib/buzzer');

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

async function buzzerDemo() {
    console.log("Buzzer ON");
    buzz.buzzerOn();
    await sleep(1000);
    
    console.log("Buzzer OFF");
    buzz.buzzerOff();
    await sleep(1000);
}

buzzerDemo();

Buzzer Functions

  • buzzerOn() - Turn buzzer on
  • buzzerOff() - Turn buzzer off

LED Control

Control the user LED:

const led = require('npm-reterminal-dm/lib/led');

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

async function ledDemo() {
    console.log("User LED ON");
    led.usrRedOn();
    await sleep(1000);
    
    console.log("User LED OFF");
    led.usrRedOff();
    await sleep(1000);
}

ledDemo();

LED Functions

  • usrRedOn() - Turn user red LED on
  • usrRedOff() - Turn user red LED off

Light Sensor

Read ambient light intensity:

const light = require('npm-reterminal-dm/lib/light');

// Single reading
console.log("Light Intensity: " + light.lightSense());

// Continuous monitoring
setInterval(() => {
    console.log("Light Intensity: " + light.lightSense());
}, 1000);

Light Sensor Functions

  • lightSense() - Returns current light intensity value

Device Detection

The package automatically detects hardware components through the device ID system:

const dev = require('npm-reterminal-dm/lib/deviceid');

// Get device paths
console.log("Touch panel path:", dev.tpPath());
console.log("Buttons path:", dev.buttonsPath());
console.log("Accelerometer path:", dev.accelPath());

Hardware Requirements

  • reTerminal DM device
  • Linux-based operating system
  • Root/sudo access for hardware control
  • Node.js environment

System Paths

The package interacts with the following system paths:

  • Touch Panel: /dev/input/eventX (where X is auto-detected)
  • Buzzer: /sys/class/leds/usr-buzzer/brightness
  • User LED: /sys/class/leds/usr-led/brightness
  • Light Sensor: /sys/bus/iio/devices/iio:device0/in_illuminance_input

Error Handling

The package includes built-in error handling for:

  • Device disconnection events
  • File system access errors
  • Hardware communication failures
const touch = new InputEvent.Touch(dev.tpPath());

touch.on('error', function(err) {
    console.error('Touch panel error:', err);
});

touch.on('disconnect', function() {
    console.log('Touch panel disconnected');
});

Permissions

Some functions require sudo privileges. Ensure your Node.js process has appropriate permissions to access hardware devices and system files.

License

MIT

Repository

https://github.com/cgjgh/npm-reterminal-dm

Issues

Report issues at: https://github.com/cgjgh/npm-reterminal-dm/issues