New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dmx4pi

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dmx4pi

Convert your Raspberry Pi into a DMX512 controller

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

DMX4PI

Convert your Raspberry Pi into a DMX controller. This requires a minimum of additional hardware and utilises the fancy-pancy DMA features of the Raspberry Pi to meet the strict timings of the DMX512 protocol. Under the hood this library uses pigpio.

Installation

Beside a running Node v4 or newer you require some dependencies:

Command for Raspbian:

sudo apt install build-essential python pigpio

Example + API

Well, calling these few methods API is kind of overexaggerated ;) The following example will show you all methods offered by the API.

// We must run this as root since we are accessing hardware directly.
// Furthermore just one instance of this driver is allowed per Pi concurrently.

// Load and configure the drivers:
const DMX = require( 'dmx4pi' )( {
	// Any free GPIO can be used:
	pinTx: 22,   // Data pin
	pinEn: 27,   // Enable ping
	// The signal levels can be inverted if neccessary:
	invTx: true, // Data pin
	invEn: true  // Enable pin
} );

function fadeDMX( ch3 ) {

	// Stop when channel 3 reached 255
	if( ch3 > 255 ) return;

	// Create buffer that will be transmitted: Ch 1, 2, 4, 5 are static and Ch 3 is faded
	let data = Buffer.from( [ 0, 128, ch3, 0, 0] );

	// DMX.transmit( data ) returns a promise that is fulfilled if the data has been transmitted
	return DMX.transmit( data ).then( () => fadeDMX( ++ch3 ) );

}

// Start fading and shutdown the driver when fading has been finished
fadeDMX( 0 ).then( () => DMX.close() ).catch( console.error );

Hardware

Will be described in the near future.

Keywords

FAQs

Package last updated on 14 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc