How to lights the rgb led strip using node-hid?

67 Views Asked by At

I am trying to access the HID(Human interface devices) using node-hid npm in node. i want to start the light when my node app is run. But when i pass the data it is not working. i want to start the white leds when my node app start and based on my selection it should change the color.

Can anybody guide me how i can start rgb led using node-hid?

'use strict';

var HID = require('../');
var VENDOR_ID = 0000; // device vender_id
var PRODUCT_ID = 0000; // device product_id

var devices_found = HID.devices( VENDOR_ID, PRODUCT_ID );

if( devices_found.length === 0 ) {
    console.log("no blink(1) devices found");
    process.exit(0);
}

let d = new HID.HID(devices_found[0].path);
d.on('data',function(data){console.log(data)});
d.on('error',function(error){console.log(error)});

setInterval(() => {
    d.write( [0x12, 0xc8, 0x04, 101])
}, 10);

I have tried the node-hid npm and i am able to write the data on it. the status light blinks in circuit but nothing happens to leds.

0

There are 0 best solutions below