Closed TheFonix closed 7 years ago
You should not close the artnet connection and you need to use Javascript setTimeout or setInterval function. Here a short (untested) example:
var options = {
host: 'ola'
};
var artnet = require('artnet')(options);
/**
* Fade from 0 to 255 in given ms
*/
function fadeUp(ms) {
var step = 5;
var time = Math.floor(ms / (255 / step));
var val = 0;
var interval = setInterval(function () {
artnet.set(1, null, null, val, null, null, val);
val += step;
if (val > 255) {
clearInterval(interval);
artnet.close();
}
}, time);
}
fadeUp(2000);
this is just a quick example, untested, possibly full of bugs ;-) if you want faster fades you should increase step from 5 to a higher value because you should not send to Artnet in shorter Intervals than 25ms.
Another approach would be https://github.com/hobbyquaker/mqtt-dmx-sequencer. With this tool (that also uses https://github.com/hobbyquaker/artnet under the hood) you can define Scenes and combine Scenes to a Sequence. Triggering Scenes and starting/stopping Sequences can then be done via MQTT. You could use https://github.com/node-red to send the commands via MQTT triggered by your Echo. (see https://nathan.chantrell.net/20160328/amazon-echo-alexa-skills-kit-integration-with-node-red/)
HTH
Awesome! Thanks man, ill check all these options out, always helpful being pointed in the right direction! :+1:
Is there a way to make "waits" inside this art net system? I've tried many different ways but not had any luck, or is there some kind of fading system that i can use? I currently have an Amazon Echo "Get"ing PHP pages which trigger the execution of the node which then runs the Art net Script and that then gets sent to Open Lighting architecture which of course then changes the different lights according to the data sent to them.
The whole system works perfectly fine when im just sending one insistence of a lighting change, such as:
But when i add more of them to attempt to run them as a sequence nothing happens it just chooses the first one. I've tried many different timer for NPM but none of them seem to work like i would like, my end goal is something along these lines ( Sorry about the poor example i cant think of any other way to do it)
Thanks, Hope you can help!