You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
951 B
C++
46 lines
951 B
C++
#include <SPI.h>
|
|
#include <UIPEthernet.h>
|
|
#include <UIP_ATEM.h>
|
|
|
|
//Ethernet
|
|
byte mac[] = {0xAA, 0xDD, 0xBB, 0x10, 0x01, 0x01};
|
|
IPAddress ip(192, 168, 0, 20);
|
|
|
|
//IP of the ATEM switcher
|
|
ATEM AtemSwitcher(IPAddress(192, 168, 0, 50), 56417);
|
|
|
|
//tally LEDs
|
|
const int tallyLED[] = {2,3};
|
|
const int tallyLEDlength = 2;
|
|
|
|
//define min interval to send data
|
|
unsigned long currentTime = millis();
|
|
unsigned long previousTime = 0;
|
|
const long intervalTime = 1000;
|
|
|
|
void setup(){
|
|
for (int i=0; i < tallyLEDlength; i++){
|
|
pinMode(tallyLED[i], OUTPUT);
|
|
digitalWrite(tallyLED[i], LOW);
|
|
}
|
|
|
|
//start Ethernet
|
|
Ethernet.begin(mac,ip);
|
|
|
|
Serial.begin(9600);
|
|
|
|
//connect to the switcher
|
|
AtemSwitcher.serialOutput(true);
|
|
AtemSwitcher.connect();
|
|
}
|
|
|
|
void loop(){
|
|
//check for new packets
|
|
AtemSwitcher.runLoop();
|
|
|
|
//write tally LEDs
|
|
for (int i=0; i < tallyLEDlength; i++){
|
|
digitalWrite(tallyLED[i], !AtemSwitcher.getProgramTally(i+1));
|
|
}
|
|
}
|