-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusage.ino
62 lines (48 loc) · 2.14 KB
/
usage.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*****************
* Basic ATEM Connection
* Connects to the Atem Switcher and outputs keep-alive package information
*
* - kasper
*/
/*****************
* 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!
*/
// Including libraries:
//#include <Ethernet.h>
//#include <Streaming.h>
//#include <MemoryFree.h>
#include <SkaarhojPgmspace.h>
// MAC address and IP address for this *particular* Arduino / Ethernet Shield!
// The MAC address is printed on a label on the shield or on the back of your device
// The IP address should be an available address you choose on your subnet where the switcher is also present
byte mac[] = {
0x90, 0xA2, 0xDA, 0x0D, 0x6B, 0xB9 }; // <= SETUP! MAC address of the Arduino
IPAddress clientIp(192, 168, 10, 99); // <= SETUP! IP address of the Arduino
IPAddress switcherIp(192, 168, 10, 240); // <= SETUP! IP address of the ATEM Switcher
// Include ATEMbase library and make an instance:
// The port number is chosen randomly among high numbers.
#include <ATEMbase.h>
#include <ATEMstd.h>
ATEMstd AtemSwitcher;
void setup() {
randomSeed(analogRead(5)); // For random port selection
// Start the Ethernet, Serial (debugging) and UDP:
//Ethernet.begin(mac,clientIp);
Serial.begin(115200);
//Serial << F("\n- - - - - - - -\nSerial Started\n");
// Initialize a connection to the switcher:
AtemSwitcher.begin(switcherIp);
AtemSwitcher.serialOutput(0x80);
AtemSwitcher.connect();
// Shows free memory:
//Serial << F("freeMemory()=") << freeMemory() << "\n";
}
void loop() {
// Check for packets, respond to them etc. Keeping the connection alive!
// VERY important that this function is called all the time - otherwise connection might be lost because packets from the switcher is
// overlooked and not responded to.
AtemSwitcher.runLoop();
}