Skip to content

Artnet::begin()

Mathieu edited this page Jan 24, 2020 · 1 revision

Artnet::begin()

This function is alsway required. It is used to enable the ethernet library, and start the udp listining on the Art-Net port. Additionally, it loads all default values.

Arguments

There are two different ways to use this function.

begin(byte mac[])

Uses DCHP to get an IP-addres assigned. mac[] is a 6 byte long array which stores the mac address of the ethernet module.

uint8_t begin(byte mac[], byte ip[])

In case you want a fixed (static) IP.

Return

uint8_t begin(byte mac[], byte ip[])

1 = DCHP IP address was assigned successfully 0 = No DCHP address was assigned.

void begin(byte mac[], byte ip[])

No return.

Examples

Example 1: DCHP

` #include <Artnet.h>

Artnet artnet; byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC}; vodi setup() { while(!artnet.begin(mac)) delay(5); //Retry untill an IP address is assigned. }

void loop() { uint16_t r = artnet.read(); if(r == ART_POLL) { // A poll message was received. (library answers the poll automatically) // it lets you know it did. } } `

Example 1: Static IP

` #include <Artnet.h>

Artnet artnet; byte ip[4] = {2, 0, 0, 15}; byte mac[6] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC}; vodi setup() { artnet.begin(mac, ip); }

void loop() { uint16_t r = artnet.read(); if(r == ART_POLL) { // A poll message was received. (library answers the poll automatically) // it lets you know it did. } } `