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.

75 lines
2.4 KiB
Plaintext

13 years ago
/*
Copyright 2012 Kasper Skårhøj, SKAARHOJ, kasperskaarhoj@gmail.com
This file is part of the ATEM library for Arduino
The ATEM library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The ATEM library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with the ATEM library. If not, see http://www.gnu.org/licenses/.
*/
13 years ago
13 years ago
/*****************
* Example: ATEM Monitor
* Connects to the Atem Switcher and outputs changes to Preview and Program on the Serial monitor (at 9600 baud)
*/
/*****************
* 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>
// 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, 0x00, 0xE8, 0xE9 }; // <= SETUP
IPAddress ip(192, 168, 0, 20); // <= SETUP
// 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, 0, 50), 56417); // <= SETUP (the IP address of the ATEM switcher)
void setup() {
// 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();
13 years ago
}
13 years ago
void loop() {
// Check for packets, respond to them etc. Keeping the connection alive!
AtemSwitcher.runLoop();
}