58 lines
1.3 KiB
Arduino
58 lines
1.3 KiB
Arduino
|
|
||
|
#include "Artnet.h"
|
||
|
//#include <SPI.h> // needed for Arduino versions later than 0018
|
||
|
#include <Ethernet.h>
|
||
|
#include <EthernetUdp.h>
|
||
|
|
||
|
// Ethernet stuff
|
||
|
const IPAddress ip(10, 0, 0, 10);
|
||
|
uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB};
|
||
|
|
||
|
ArtnetSender artnet;
|
||
|
|
||
|
uint8_t net = 0;
|
||
|
uint8_t subnet = 0;
|
||
|
uint8_t universe = 1;
|
||
|
|
||
|
const uint16_t size = 512;
|
||
|
uint8_t data[size];
|
||
|
uint8_t value = 0;
|
||
|
|
||
|
void setup()
|
||
|
{
|
||
|
Ethernet.begin(mac, ip);
|
||
|
artnet.begin("10.0.0.11");
|
||
|
|
||
|
Serial.begin(115200);
|
||
|
while (!Serial) {
|
||
|
; // wait for serial port to connect. Needed for native USB port only
|
||
|
}
|
||
|
Serial.println("start");
|
||
|
|
||
|
// // Check for Ethernet hardware present
|
||
|
// if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
||
|
// Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
|
||
|
// while (true) {
|
||
|
// delay(1); // do nothing, no point running without Ethernet hardware
|
||
|
// }
|
||
|
// }
|
||
|
// if (Ethernet.linkStatus() == LinkOFF) {
|
||
|
// Serial.println("Ethernet cable is not connected.");
|
||
|
// }
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
value = millis() % 256;
|
||
|
memset(data, value, size);
|
||
|
|
||
|
//artnet.set(universe, data, size);
|
||
|
artnet.send(net, subnet, universe, data, size);
|
||
|
Serial.println(data[0]);
|
||
|
delay(30);
|
||
|
//artnet.streaming(); // automatically send set data in 40fps
|
||
|
|
||
|
}
|