Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h> // needed for Arduino versions later than 0018
- #include <Ethernet.h>
- #include <ATEM.h>
- byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x66, 0x07 }; // ARDUINO MAC
- IPAddress ip(192, 168, 5, 25); // ARDUINO IP
- int button1 = 2;
- int button2 = 4;
- int button3 = 6;
- int button4 = 8;
- int button5 = 10;
- int button5 = 12;
- int tally1 = 3;
- int tally2 = 5;
- int tally3 = 7;
- int tally4 = 9;
- int tally5 = 11;
- int tally6 = 13;
- bool lastButton = LOW;
- bool ledOn = false;
- bool currentButton = LOW;
- bool lastState = false;
- ATEM AtemSwitcher(IPAddress(192, 168, 5, 5), 56417); // ATEM SWITCHER IP and RANDOM PORT
- bool debounce(bool last,int pinNumber)
- {
- bool current = digitalRead(pinNumber);
- if (last != current)
- {
- delay(20);
- current = digitalRead(pinNumber);
- }
- return current;
- }
- void setup()
- {
- pinMode(tally1, OUTPUT);
- pinMode(tally2, OUTPUT);
- pinMode(tally3, OUTPUT);
- pinMode(tally4, OUTPUT);
- pinMode(tally5, OUTPUT);
- pinMode(tally6, OUTPUT);
- pinMode(button1, INPUT);
- pinMode(button2, INPUT);
- pinMode(button3, INPUT);
- pinMode(button4, INPUT);
- pinMode(button5, INPUT);
- pinMode(button6, INPUT);
- Ethernet.begin(mac,ip);
- Serial.begin(9600);
- // Initialize a connection to the switcher:
- AtemSwitcher.serialOutput(true);
- AtemSwitcher.connect();
- }
- void loop()
- {
- // Check for packets, respond to them etc. Keeping the connection alive!
- AtemSwitcher.runLoop();
- digitalWrite(progTally1Pin, AtemSwitcher.getProgramTally(5));
- if (!AtemSwitcher.getProgramTally(5))
- {
- digitalWrite(tally1, HIGH);
- //Serial.println("ON");
- }
- else
- {
- digitalWrite(tally1, LOW);
- //Serial.println("OFF");
- }
- // delay(1000);
- // else
- // {
- // //digitalWrite(progTally1Pin, HIGH);
- // //Serial.println("OFF");
- // }
- //
- // currentButton = debounce(lastButton, cutPin);
- // if (lastButton == LOW && currentButton == HIGH )
- // {
- // Serial.println("Cut");
- // AtemSwitcher.doCut();
- // }
- // lastButton = currentButton;
- }
Advertisement
Add Comment
Please, Sign In to add comment