const mod = require('.')

const o = mod.openOutput("/dev/ttyUSB0")

if (o.type == 'success') {

    const output = o.value;

    const movingHeads = [
        {
            startAddress: 1,
            pan: 0,
            tilt: 0,
            brightness: {
                type: "dimmer",
                value: 1,
            },
            rgbw: [255, 0, 0, 0],
            speed: 0,
            reset: false,
        },
        {
            startAddress: 15,
            pan: 0,
            tilt: 0,
            brightness: {
                type: "dimmer",
                value: 1,
            },
            rgbw: [255, 0, 0, 0],
            speed: 0,
            reset: false,
        },
        {
            startAddress: 29,
            pan: 0,
            tilt: 0,
            brightness: {
                type: "dimmer",
                value: 1,
            },
            rgbw: [255, 0, 0, 0],
            speed: 0,
            reset: false,
        },
        {
            startAddress: 43,
            pan: 0,
            tilt: 0,
            brightness: {
                type: "dimmer",
                value: 1,
            },
            rgbw: [0, 255, 0, 0],
            speed: 1,
            reset: false,
        }
    ];


    let r = output.set(movingHeads);
    console.log(r);

    output.close();

}