// *************************************************************** // * Behringer XR18 Arduino MIDI Remote Control * // * By Vern Graner * // *************************************************************** // * This code connects to WiFI and sends OSC commands to an * // * Behringer XR18. You have to enter an IP address for the * // * mixer for this demo to work * // *************************************************************** // * Rev Info: V1.0a (VLG) 01-22-2018 Basic proof of concept * // * : V3.2a (VLG) 01-27-2018 CH1&2 mute, FOH/HOSTS PTT * // * : V3.2a (VLG) 01-27-2018 PROTOTYPE1 NO OLED * // * : V3.5a (VLG) 01-28-2018 Use array for OSC commands * // *************************************************************** #include // For WiFi #include // For WiFi // Include the MIDI stuff #include // For OSC support #include // MIDI support #include #include #include #include // Assign Button Functions // *************************************************** // define button arrays Format is "","", const char* buttonCommand[]={ "/ch/16/mix/01/level","-127", // Button 0 Up: Ch 16 to AUX 1 INFINITY "/ch/16/mix/01/level","0", // Button 0 Down: Ch 16 to AUX 1 UNITY GAIN "/ch/16/mix/02/level","-127", // Button 1 Up: Ch 16 to AUX 2 INFINITY "/ch/16/mix/02/level","0", // Button 1 Down: Ch 16 to AUX 2 UNITY GAIN "/ch/01/mix/on","ON", // Button 2 Up: Ch 1 UN-MUTE "/ch/01/mix/on","OFF", // Button 2 Down Ch 1 MUTE "/ch/02/mix/on","ON", // Button 3 Up Ch 2 UN-MUTE "/ch/02/mix/on","OFF", // Button 3 Down Ch 2 MUTE }; // Setup button pins int myButtons[] = {39,34,25,26}; // define the pins for the buttons int buttonCount = 4; // set the number of buttons in the loop // Define program Variables int buttonState[] = {0,0,0,0}; // current state of the button int lastButtonState[] = {0,0,0,0}; // previous state of the button // Setup LED pins int myLeds[]={32,15,33,27}; // define the pins for the LEDs int ledCount=4; // set the number of LEDs in the loop // MIDI OSC Hex converter int commandLength=0; byte bigMidiCommand[64]; // maximum command length in bytes byte midiHeader[]= { 0xF0,0x00,0x20,0x32,0x32 }; // XR18 OSC preamble byte midiSpacer[]= { 0x20 }; // XR18 OSC post-amble byte midiFooter[]= { 0xF7 }; // XR18 OSC post-amble int count; // Command Counter int i=0; // Button counter int j=0; // bigMIDIcommand counter HardwareSerial Serial1(2); // setup MIDI on TX pin MIDI_CREATE_INSTANCE(HardwareSerial,Serial1, midiOut); // create a MIDI object called midiOut // WiFi setup char ssid[] = "YOURSSID"; // your network SSID (name) char pass[] = "YOURPASS"; // your network password WiFiUDP Udp; // A UDP instance to let us send and receive packets over UDP const IPAddress outIp(192,168,1,128); // IP of the XR18 in Comma Separated Octets, NOT dots! const unsigned int outPort = 10024; // remote port to receive OSC X-AIR is 10024, X32 is 10023 const unsigned int localPort = 8888; // local port to listen for OSC packets (actually not used for sending) void setup() { Serial.begin(115200); // DEBUG window Serial1.begin(31250); // setup MIDI output midiOut.begin(); //Setp pin mode for buttons for (int i=0;i