Created
June 7, 2013 15:57
-
-
Save drart/5730329 to your computer and use it in GitHub Desktop.
Arduino Code for Luminato Project. (V0.001)
This file contains 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
/***************** | |
* Example: ATEM Basic Control | |
* Connects to the Atem Switcher and outputs changes to Preview and Program on the Serial monitor (at 9600 baud) | |
* Uses digital inputs 2 and 3 (active High) to select input 1 and 2 on Preview Bus | |
/***************** | |
* TO MAKE THIS EXAMPLE WORK: | |
* - You must have an Arduino with Ethernet Shield (or compatible such as "Arduino Ethernet", http://arduino.cc/en/Main/ArduinoBoardEthernet) | |
* - You must have an Atem Switcher connected to the same network as the Arduino - and you should have it working with the desktop software | |
* - You must make specific set ups in the below lines where the comment "// SETUP" is found! | |
*/ | |
#include <SPI.h> // needed for Arduino versions later than 0018 | |
#include <Ethernet.h> | |
//#include <Servo.h> | |
//Servo myservo; // create servo object to control a servo | |
// a maximum of eight servo objects can be created | |
// MAC address and IP address for this *particular* Ethernet Shield! | |
// MAC address is printed on the shield | |
// IP address is an available address you choose on your subnet where the switcher is also present: | |
byte mac[] = { | |
0x90, 0xA2, 0xDA, 0x0D, 0x4A, 0x01 }; // <= DONE | |
IPAddress ip(192, 168, 10, 99); // <= DONE | |
// Include ATEM library and make an instance: | |
#include <ATEM.h> | |
// Connect to an ATEM switcher on this address and using this local port: | |
// The port number is chosen randomly among high numbers. | |
ATEM AtemSwitcher(IPAddress(192, 168, 10, 240), 56417); // <= DONE (the IP address of the ATEM switcher) | |
// No-cost stream operator as described at | |
// http://arduiniana.org/libraries/streaming/ | |
template<class T> | |
inline Print &operator <<(Print &obj, T arg) | |
{ | |
obj.print(arg); | |
return obj; | |
} | |
void setup() { | |
// Set up pins for | |
//pinMode(7, INPUT); // Cut | |
pinMode(53, INPUT); // Select 1 for Preview | |
pinMode(51, INPUT); // Select 2 for Preview | |
pinMode(49, INPUT); | |
pinMode(47, INPUT); | |
pinMode(45, INPUT); | |
pinMode(43, INPUT); | |
pinMode(41, INPUT); | |
digitalWrite(53, HIGH); | |
digitalWrite(51, HIGH); | |
digitalWrite(49, HIGH); | |
digitalWrite(47, HIGH); | |
digitalWrite(45, HIGH); | |
digitalWrite(43, HIGH); | |
digitalWrite(41, HIGH); | |
// Start the Ethernet, Serial (debugging) and UDP: | |
Ethernet.begin(mac,ip); | |
Serial.begin(9600); | |
// Initialize a connection to the switcher: | |
AtemSwitcher.serialOutput(true); | |
AtemSwitcher.connect(); | |
AtemSwitcher.changeProgramInput(2); | |
AtemSwitcher.changeAudioChannelMode(8,1); // 8 -> Media Player 1 audio input, 1-> ON | |
} | |
// For pushButtons: | |
int pushButton = 0; | |
void loop() { | |
// Check for packets, respond to them etc. Keeping the connection alive! | |
AtemSwitcher.runLoop(); | |
pushButton = 2; | |
if (digitalRead(53)) | |
AtemSwitcher.changeProgramInput(2); | |
else if (digitalRead(51)) | |
AtemSwitcher.changeProgramInput(3); | |
else if (digitalRead(49)) | |
AtemSwitcher.changeProgramInput(4); | |
else if (digitalRead(47)) | |
AtemSwitcher.changeProgramInput(5); | |
else if (digitalRead(45)) | |
AtemSwitcher.changeProgramInput(6); | |
else if (digitalRead(43)) | |
AtemSwitcher.changeProgramInput(7); | |
else if (digitalRead(41)) | |
AtemSwitcher.changeProgramInput(8); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment