<commit_before>let fivetwelve = require('fivetwelve/es5');
let EnttecUsbDmxProDriver = require('fivetwelve-driver-usbpro/es5');
let Serialport = require('serialport');
let randomColor = require('random-color');

const usbProSerialport = new Serialport('/dev/cu.usbserial-EN193448');
const driver = new EnttecUsbDmxProDriver.default(usbProSerialport);
const output = fivetwelve.default(driver, 2);

// Cameo FLAT PAR 1 RGBW
const device1 = new fivetwelve.DmxDevice({
  universe: 1,
  address: 100,
  params: {
    dimmer: new fivetwelve.param.RangeParam(1),
    strobe: new fivetwelve.param.RangeParam(2, { min: 0, max: 255 }),
    color: new fivetwelve.param.RgbParam([3, 4, 5]),
    white : new fivetwelve.param.RangeParam(6, { min: 0, max: 255 })
  }
});

const device2 = new fivetwelve.DmxDevice({
  universe: 2,
  address: 100,
  params: {
    dimmer: new fivetwelve.param.RangeParam(1),
    strobe: new fivetwelve.param.RangeParam(2, { min: 0, max: 255 }),
    color: new fivetwelve.param.RgbParam([3, 4, 5]),
    white : new fivetwelve.param.RangeParam(6, { min: 0, max: 255 })
  }
});

let dimmer = 1;

// connect the device to the dmx-output
device1.setOutput(output);

device1.dimmer = dimmer;
device1.strobe = 0;
device1.color = 'rgb(0, 0, 0)';
device1.white = 0;

// connect the device to the dmx-output
device2.setOutput(output);

device2.dimmer = dimmer;
device2.strobe = 0;
device2.color = 'rgb(0, 0, 0)';
device2.white = 0;


// Animation loop
output.requestDmxFrame(function loop(time) {

  device1.color = randomColor().rgbString();
  device2.color = randomColor().rgbString();

  // register the loop-function again for the next frame
  output.requestDmxFrame(loop);
});

// fps
output.start(1000 / 10);
<commit_msg>Refactoring to add the latest version of "fivetwelve-driver-usbpro" and added comments.<commit_after>let fivetwelve = require('fivetwelve/es5');
let fivetwelve_driver_usbpro = require('fivetwelve-driver-usbpro/es5');
let Serialport = require('serialport');
let randomColor = require('random-color');


// Serial connection to Enttec DMX USB PRO Mk2
const usbProSerialport = new Serialport('/dev/cu.usbserial-EN193448');

// Initialize the driver using the serial connection
const driver = new fivetwelve_driver_usbpro(usbProSerialport);

// Create the output using the driver and initialize 2 universes
const output = fivetwelve.default(driver, 2);



// Create a default configuration for the DMX devices
const cameo_flat_led_par = {
    dimmer: new fivetwelve.param.RangeParam(1),
    strobe: new fivetwelve.param.RangeParam(2, { min: 0, max: 255 }),
    color: new fivetwelve.param.RgbParam([3, 4, 5]),
    white : new fivetwelve.param.RangeParam(6, { min: 0, max: 255 })
};



// Create the DMX devices by using the default configuration
const device1 = new fivetwelve.DmxDevice({
  universe: 1,
  address: 100,
  params: cameo_flat_led_par
});

const device2 = new fivetwelve.DmxDevice({
  universe: 2,
  address: 100,
  params: cameo_flat_led_par
});



// Connect the devices to the DMX output
device1.setOutput(output);
device2.setOutput(output);



let dimmer = 1;

// Set initial values for the devices
device1.dimmer = dimmer;
device1.strobe = 0;
device1.color = 'rgb(0, 0, 0)';
device1.white = 0;

device2.dimmer = dimmer;
device2.strobe = 0;
device2.color = 'rgb(0, 0, 0)';
device2.white = 0;



// Animation loop
output.requestDmxFrame(function loop(time) {

  // Set a random color for each device
  device1.color = randomColor().rgbString();
  device2.color = randomColor().rgbString();

  // Recursion
  output.requestDmxFrame(loop);
});



// Start the DMX output with the specified fps
output.start(1000 / 1);

{'fraction_non_alphanumeric': 0.1304941304941305, 'fraction_numerical': 0.03822003822003822, 'mean_word_length': 4.372434017595308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2024796', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1298, 'n_words': 333}