// *************************************************************** // * 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 * // * : V3.5C (VLG) 02-06-2018 Cough Box V1 * // *************************************************************** #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/01/mix/on","ON", // Button 0 Up: Ch 1 UN-MUTE "/ch/01/mix/on","OFF", // Button 0 Down: Ch 1 MUTE "/ch/02/mix/on","ON", // Button 1 Up: Ch 2 UN-MUTE "/ch/02/mix/on","OFF", // Button 1 Down: Ch 2 MUTE "/ch/03/mix/on","ON", // Button 2 Up: Ch 3 UN-MUTE "/ch/03/mix/on","OFF", // Button 2 Down Ch 3 MUTE "/ch/04/mix/on","ON", // Button 3 Up Ch 4 UN-MUTE "/ch/04/mix/on","OFF", // Button 3 Down Ch 4 MUTE }; // WiFi setup // char ssid[] = "NETGEAR38"; // your network SSID (name) // char pass[] = "phobicrosebud574"; // your network password char ssid[] = "GRANER"; // your network SSID (name) char pass[] = "frontera"; // your network password WiFiUDP Udp; // A UDP instance to let us send and receive packets over UDP const IPAddress outIp(192,168,77,100); // IP of the XR18 in Comma Separated Octets, NOT dots! // 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) // Pin combos for Cough Drop Box // Button/LED pin combos Button 0 15/25 // Button/LED pin combos Button 1 27/34 // Button/LED pin combos Button 0 32/39 // Button/LED pin combos Button 3 33/26 // Setup LED pins int myLeds[]={15,27,32,33}; // define the pins for the LEDs int ledCount=4; // set the number of LEDs in the loop // Setup button pins int myButtons[] = {25,34,39,26}; // define the pins for the buttons int buttonCount = 4; // set the number of buttons in the loop // Button & LED Pair pin numbers: // Button0 = 15, LED0 = 25 // Button1 = 27, LED0 = 34 // Button2 = 32, LED0 = 39 // Button3 = 33, LED0 = 26 // Setup button type int buttonToggle[] = {0,0,0,0}; // "0" is for follow state 1 is for toggle state // 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 // 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 int WiFiWait=0; // Wait Counter HardwareSerial Serial1(2); // setup MIDI on TX pin MIDI_CREATE_INSTANCE(HardwareSerial,Serial1, midiOut); // create a MIDI object called midiOut void setup() { Serial.begin(115200); // DEBUG window Serial1.begin(31250); // setup MIDI output midiOut.begin(); //Setup pin mode for buttons for (int i=0;i