Created
January 15, 2018 02:51
-
-
Save buzztiaan/3400de7c57c98411c3339e0375c6f711 to your computer and use it in GitHub Desktop.
set all art-net channels on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use IO::Socket::INET; | |
my $sig = 'Art-Net'.pack('x'); | |
my $op = pack('v', 0x5000); | |
my $ver = pack('n', 14); | |
my $seq = pack('x'); | |
my $phy = pack('x'); | |
my $port = pack('n', 0); #universe | |
my @channels = (255) x 512; # set all 512 channels to '255' | |
$length = pack('n', scalar @channels); | |
my $data = pack('C*', @channels); | |
my $message = $sig.$op.$ver.$seq.$phy.$port.$length.$data; | |
my $sock = IO::Socket::INET->new( | |
Proto => 'udp', | |
PeerPort => 6454, | |
PeerAddr => inet_ntoa(INADDR_BROADCAST), | |
Broadcast => 1, | |
) or die "Could not create socket: $!\n"; | |
$sock->send($message) or die "Send error: $!\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment