-
Posts
229 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by Devon Custard
-
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Edited a 595 chip and changed the tag from memory -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Reread your question. A better answer is - Yes you dont need to sync up, as you are reading the dial position and rendering the value on a LED display. If you have the UDP listener running before the mission loads (i.e. before you click on FLY), the LEDs WILL sync up. Well the UHF will at least, have just tested that. :smartass: Ok i now feel rather clever.... -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
On my system its C:\Program Files\Eagle Dynamics\DCS World\Mods\aircrafts\A-10C\Cockpit\Scripts Have a look at mainpanel_init.lua as well -
Right, if youve been following my arduino guide you'll know ive been working on the electronics to drive 7 segment displays. Just managed to get my futaba 20x2 VFD working, which given the arcane mumbo jumbo they sent me im gobsmacked it was that easy. Actually running out of electronic gizmos i need to work on. Only think thats left to do is work on the gauges and thats a fabrication thing now. So its on to panel making, laser has arrived, just need to set it up and do some design work. Then i can start posting some decent photos.
-
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
And as for the cold, doing this keeps my mind off how frickin miserable this cold is making me :) That and cooking dinner for the pit wife. :D -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
What im doing is reading the value of the UHF radio switches, found the data in clickabledata.lua elements["PTR-ANARC164-CHANNEL-SELECTOR"] = multiposition_switch_limited(_("Preset Channel Selector"), devices.UHF_RADIO, device_commands.Button_1, 161,20,0.05) elements["PTR-ANARC164-100MHZ-SELECTOR"] = multiposition_switch_limited(_("100 MHz Selector") , devices.UHF_RADIO, device_commands.Button_2, 162, 3, 0.1) elements["PTR-ANARC164-10MHZ-SELECTOR"] = multiposition_switch_limited(_("10 MHz Selector"), devices.UHF_RADIO, device_commands.Button_3, 163, 10, 0.1) elements["PTR-ANARC164-1MHZ-SELECTOR"] = multiposition_switch_limited(_("1 MHz Selector"), devices.UHF_RADIO, device_commands.Button_4, 164, 10, 0.1) elements["PTR-ANARC164-0.1MHZ-SELECTOR"] = multiposition_switch_limited(_("0.1 MHz Selector"), devices.UHF_RADIO, device_commands.Button_5, 165, 10, 0.1) elements["PTR-ANARC164-0.025MHZ-SELECTOR"] = multiposition_switch_limited(_("0.025 MHz Selector"), devices.UHF_RADIO, device_commands.Button_6, 166, 4, 0.1) The problem i noticed is that the export scripts dont pass that data out until theres a change on the switch. Easy way to sync this up is to toggle the switches as part of your startup sequence. Not sure if thats something in the lua export or something in Gadrocs scripts. When i have a clear head ill see if i can extract the data at startup. I understand that someone managed to read the default presets from the mission data. Not sure how dedicated i am tho :) -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Full working prototype. c# code and sketch in first post. Level of frustration getting this to work smoothly was relatively high this weekend. Probably not helped by this steeenking cold i have :) Found there was a hard limit on the number of 7 segments i could drive. As soon as i exceeded 6, the LEDs started to blink and wouldnt update. Im guessing i hit a hard limit on the power. However given the cost of the components driving 6 led displays with a single arduino seems not to much of a cost. DCS 1.2.7 btw. And thats the UHF radio im exporting. Reading the 162-166 argument values. -
Options for exporting Black Shark data
Devon Custard replied to Extranajero's topic in Home Cockpits
Look at my guide for exporting to an arduino if you want to do it on the cheap. There are a number of IC's out there dedicated to driving LEDs, its relatively simple to design a circuit to turn a LED on and off using an arduino. See this one http://arduino.cc/en/Tutorial/Blink. Adding more LEDs to your circuit requires a little more thought. On top of that you need to export the data to an arduino. Again Gadrocs EOS bus will do that for you, as will my guide, i go into the process in depth and can help you writre your own UDP listener. If you want specific details throw me a PM -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Updated circuit. Found fritzings superb breadboard and arduino design app. Used that to generate the circuit. Damn sight easier to use than Visio :) http://fritzing.org/download/ The external power supply is 5V. -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Cheers Boltz, always nice to get positive feedback. Which is ironic considering what im about to say..... Word of warning to those implementing my circuit diagram, i realised that although i wired it correctly ( i think ) i drew the diagram from my perspective i.e. the underside of the matrix board. So those pins on the ICs will be back to front. If you followed the schematic of the chip then youd be fine, but if you trusted me to draw it right, im afraid to say im an eeeediot. The pin numbers are correct, the position of the pin isnt. :doh::doh::doh::doh::doh::doh::doh::doh::doh::doh: -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
@ Boltz / Joe Kurr. I kinda figured most people were doing something along these lines, i just hadnt seen anyone post details on how to do it which is why i wrote the guide. -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Jimbo that first sketch i posted should drive the LEDs in a single loop. Thats to prove the circuit works. If youre stuck with the LEDs in a fixed pattern then im guessing the latch enable pin isnt firing on the 4511s. That should be a common pin from the arduino, from memory thats pin 13 on the arduino and pin 5 on the 4511s. That SR you quoted should be fine. Let me double check the circuit (im going to release an updated design for it anyway). -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Yup, looks pretty much the same.:) Nice -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Ok found the issue, seems using a common latch pin signal doesnt work on the 4511 chips. Will rework the sketch & circuit to use multiple pins, not brilliant but should work until i can resolve why..... -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Having fun translating this from breadboard to prototype matrix board at present. Shift registers playing up which is royally annoying. Plus i find everytime i look at the circuit i find myself saying, "oh why dont i do this instead". :) I put the BCDs in to seperate the power supply and making the wiring to LED easier, but actually i think i just complicated it. I might have a newer vesion of the circuit without the BCDs....... Ah well im having fun.... -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
hahah witchcraft :) Help is here. Im gonna churn out a more complete sketch and version of the Listener this weekend with examples of how to extend it.... After that its just the usual Imagination is just your limiting factor (or someone elses if youre nice to them) Oh and someone was really polite and asked me if i was sharing or selling my sketches/code. Sharing obviously. I plan on asking lots of questions myself and figure least i can do is share my own experience if someone is crazy enough to ask my opinions. -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Ok simple circuit. Take an arduino, wire pin 13 to the anode of an LED with a 100R resistor. Wire the cathode to the arduino's ground. Its one of the most basic arduino circuits there is. This is your master caution LED. I did it with my illuminated tactile switch but thats just an LED on a switch and its a seperate circuit so makes no difference. http://uk.rs-online.com/web/p/tactile-switches/6927005/ Now wire a switch to whatever input board youre using. I always use one of the leo bodnar boards BU0836x for my rapid prototyping. I have a brydling board for the final wire up but the bodnar for testing as its really fricking quick to setup. http://www.leobodnar.com/products/BU0836X/ Map your switch in DCS to the master caution switch on the UFC. Upload this sketch to your arduino... #define LED 13 String command; String value; int start=0; int mid=0; void setup() { Serial.begin(9600); command=""; value=""; pinMode(LED,OUTPUT); } void loop() { if(Serial.available()) { int c=Serial.read(); if (start==1) { if (c=='-') mid=1; else if(c=='#') { ProcessData(); } else if(mid==0) { command=command+char©; } else { value=value+char©; } } else if(c=='*') { start=1; } } } void ProcessData() { switch(command.toInt()) { case 404: if (value=="1.0") digitalWrite(LED,HIGH); else digitalWrite(LED,LOW); break; } mid=0; start=0; command=""; value=""; } Here you can see im reading the inbound serial stream from the USB COM port in loop(). I read the stream until i receive a valid command packet of the *xxx-yyy# format where xxx is the argument and yyy is the value. When i have that i call ProcessData and use a switch statement to run the relevant code. In this case im only interested in argument 404 (master caution state) and depending on the value which is either 1.0 or 0.0 i set the state of the LED pin to go HIGH or LOW which is 5v or 0v. LED on or off. Oh wait i forgot to amend my listener to output the UDP stuff over serial didnt i. Lets do that next. Open the UDP Listener solution in Visual Studio. In the solution explorer, click on Form1.cs, right click and select View code. This brings up the code editor (might already be open depending on how you closed the solution). Find the ProcessData function private void ProcessData( string data) { string[] d2 = data.Split( '='); if (d2.Length != 2) return; switch (d2[0]) { case "2251": // textBoxILS.Text = d2[1].ToString(); switch (d2[1].ToString().Substring(0, 3)) { case "0.0": SendSerialData( "101", "108" ); break; case "0.1": SendSerialData( "101", "109" ); break; case "0.2": SendSerialData( "101", "110" ); break; case "0.3": SendSerialData( "101", "111" ); break; default: break; } break; default: break; } } Change it to private void ProcessData( string data) { string[] d2 = data.Split( '='); if (d2.Length != 2) return; switch (d2[0]) { case "2251": // textBoxILS.Text = d2[1].ToString(); switch (d2[1].ToString().Substring(0, 3)) { case "0.0": SendSerialData( "101", "108" ); break; case "0.1": SendSerialData( "101", "109" ); break; case "0.2": SendSerialData( "101", "110" ); break; case "0.3": SendSerialData( "101", "111" ); break; default: break; } break; case "404": SendSerialData("404",d2[1].ToString(); break; default: break; } } The updated code is in red. Finally open the Form Designer, right click on Form1.cs and select view designer. Click on the serialPort1 (at the bottom of the form) and change the property PortName to the COMx port you are connected to your arduino with. HINT, your sketch editor will tell you at the bottom of the editor Should say Arduino on COMx... If you run the above sketch and the UDP Listener you should be able to trigger a master caution in DCS and see a flashing LED. I normally trigger the boost pumps toggle switch whilst sitting on the tarmac. Pressing my tactile switch turns it off(actually it just stops flashing, sometimes it stays on. I need to write a timer to turn it off when the value doesnt change for a second or two) Hmmm this last part of the guide feels a bit rushed. Ill edit it into something more friendly later this week. -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Lol halfway thru a post for the UFC sketch so ill post BOTH. oooh 2 for 1 bargain price :D Really nice to hear about your penny drop moment. If i've managed to help at least one person then the effort was worthwhile. Ill finish my other post and upload the sketches -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
How about i post the UFC master caution sketch and circuit? Its kinda simple, one tactile switch with combined led, but anyone can simulate it with a tactile switch and a seperate led. -
TBH canceled the CNC ordered as they delayed the order by up to 6 weeks. I reckon the laser cutter/engraver will do most of what i need. Marlow. Not far at all! Just figured out how to light my master caution switch using my arduino solution so i think the UFC will be my first panel i try to complete. LED displays for the radio panels arrived today so ill be soldering the leads tonight.
-
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Jimbo, i know how you feel. TBH googling was precisely how i conquered this. Dont be afraid to ask, i might not be able to answer clearly (or correctly) but at least someone out there will be able to. A really good place to start is this arduino tutorial http://arduino.cc/en/tutorial/ShiftOut Then read this one http://scuola.arduino.cc/courses/lessons/view/B7xOJzE Dont worry about understanding it at first. Just accept it will work (When wired correctly). Understanding comes later :) -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Part 2 !!! First we start with a pretty diagram. I hope you have lots of tinned wire :music_whistling: If that has frightened you off nothing will. Facepalm moment. :doh: Thats actually a 74HC595 not a 75HC595...... and i missed a ground link from the LED CCpin to the 5v ground. List of parts you will need. 1 metric ton of equipment in various colours - I jest its only 500 kilos worth 2 x 74HCF4511. Actually there are many 4511 chips out there. I just know this one worked. 1 x 74HC595 Apparently this chip is a classic. And before anyone bitches about the limited amount of current it can sink ahhah i have a cunning plan. 14 x 100R Resistors ( 5v supply. Each LED has a 2.5V forward voltage and 25mA so the gurus behind the led resistance calculator tell that a 100R/Ohm resistor will do the job) 2 x 7 Segment LED display of the Common Cathode variety. CAVEAT: My resistor choice is based on the specs of my LED display, you need to verify calcs for whatever you buy. Any questions just ask., Or use this....http://led.linear1.org/1led.wiz Also i deliberately havent shown the full wiring for the LED displays. Simply because i dont know what youre going to use. However its a damn good bet that you will have seven pins a-f, 1 pin called DP and 2 pins called CC or common anode. Pins 1-7 should be matched a-g i.e. 1-a 2-b etc. Ignore DP (decimal point) as the BCD wont use it. Finally CC needs to be wired to the ground of the external 5v supply (not the arduinos grd) Each segment is a LED in its own right so calculate resistance per segment and put the resistor in front of the led segment. Dont be cheap and place it on the cathode. Go and wire that up. Note the 5V supply thats wired to GRD and VCC pins of the 4511 chips (pins 8 and 16). Thats a seperate power line thats wired to a 5v adaptor (4 x 1.5 batteries in series will do that job). The reason im doing this is the the arduino can only drive so much current before it will blow :helpsmilie: Driving the BCD chips on a seperate loop keeps the power requirements away from the arduino. All you are doing is passing a data signal per pin at little or no current(or so i believe). Once you've wired that up. Upload this sketch #define LATCH_ENABLE 13 #define LATCHPIN 8 #define CLOCKPIN 12 #define DATAPIN 11 int x; byte data; byte led1[10]; byte led2[10]; void setup() { led1[0]=0b00000000; led1[1]=0b00000001; led1[2]=0b00000010; led1[3]=0b00000011; led1[4]=0b00000100; led1[5]=0b00000101; led1[6]=0b00000110; led1[7]=0b00000111; led1[8]=0b00001000; led1[9]=0b00001001; led2[0]=0b00000000; led2[1]=0b00010000; led2[2]=0b00100000; led2[3]=0b00110000; led2[4]=0b01000000; led2[5]=0b01010000; led2[6]=0b01100000; led2[7]=0b01110000; led2[8]=0b10000000; led2[9]=0b10010000; x=0; Serial.begin(9600); pinMode(LATCHPIN,OUTPUT); pinMode(LATCH_ENABLE,OUTPUT); } void loop() { if (x==9) x=0; else x++; data=led1[x]|led2[x]; digitalWrite(LATCH_ENABLE,LOW); digitalWrite(LATCHPIN,LOW); shiftOut(DATAPIN,CLOCKPIN,data); shiftOut(DATAPIN,CLOCKPIN,data); digitalWrite(LATCHPIN,HIGH); digitalWrite(LATCH_ENABLE,HIGH); delay(300); } // the heart of the program void shiftOut(int myDataPin, int myClockPin, byte myDataOut) { // This shifts 8 bits out MSB first, //on the rising edge of the clock, //clock idles low //internal function setup int i=0; int pinState; pinMode(myClockPin, OUTPUT); pinMode(myDataPin, OUTPUT); //clear everything out just in case to //prepare shift register for bit shifting digitalWrite(myDataPin, 0); digitalWrite(myClockPin, 0); //for each bit in the byte myDataOut� //NOTICE THAT WE ARE COUNTING DOWN in our for loop //This means that %00000001 or "1" will go through such //that it will be pin Q0 that lights. for (i=7; i>=0; i--) { digitalWrite(myClockPin, 0); //if the value passed to myDataOut and a bitmask result // true then... so if we are at i=6 and our value is // %11010100 it would the code compares it to %01000000 // and proceeds to set pinState to 1. if ( myDataOut & (1<<i) ) { pinState= 1; } else { pinState= 0; } //Sets the pin to HIGH or LOW depending on pinState digitalWrite(myDataPin, pinState); //register shifts bits on upstroke of clock pin digitalWrite(myClockPin, 1); //zero the data pin after shift to prevent bleed through digitalWrite(myDataPin, 0); } //stop shifting digitalWrite(myClockPin, 0); } This will drive a simple loop and output 0-9 to both LEDs to test your circuit works. I figure that will keep you busy long enough for me to double check the final bit of code. NEARLY THERE!! -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
Thanks HMA, always appreciate comments :) Why writing a UDP listener? Like i said its only one way to do it, there are many others. But my reasons for doing it this way were... 1. No experience with writing UDP code on the arduino. But plenty in C# 2. The arduino comes with a USB interface which provides serial comms already. The serial monitor is easier to use to debug (for me at this point, purely because im still learning the arduino) 3. More component = more cost. 4. Im probably going to run more than one board. At which point i might switch over to Gadrocs EOS bus if he has the libraries to drive 7 seg / alpha numeric displays. Either way using one UDP listener means im putting less strain on the lua scripting engine. I reckon my C# will outperform the lua script as i can multi thread if i need to. 4. lastly but more importantly, I want to translate the exported values on my pc which has spare processing capacity and memory plus its a damn site faster. The arduino is purely a driver to my instruments. I havent hit the arduino limits yet but i reckon i will at some point. To be honest in about 6 months i might just rewrite this all and go ethernet shield but im still a n00b. I only started this over the Xmas holidays ( not the coding tho :)) -
DC Guides presents "Exporting data to an Arduino 101"
Devon Custard replied to Devon Custard's topic in Home Cockpits
My pleasure :D Should have the second part done this week, just need to finish the circuit diagram for the Arduino,. -
Ok as requested by a number of people heres my little guide (part 1 anyway) on ONE way to export some of data on the radio panels out of DCS onto some 7 segment LEDs. Why? Just because i wanted to try it :) Firstly, im standing on the shoulder of giants, a lot of what im going to talk about has already been done and explained in depth on this forum. Im just bundling it all together and explaining how it links up.. If at any point i tread on someones toes i apologise, let me know and ill amend the post. Second lets explain how we are going to do it. 1. Exporting the data from DCS. The data that drives whatever instrument panels you are building needs to come from somewhere. Its coming from DCS but to use it you need to get it out and in a usable format. We're going to use HELIOS to deliver that. 2. Modify your data into something that your Arduino sketch can work with. I dont want to do too much coding on the arduino platform so im going to use my desktop (or another if needs be) to model/map any data. DCS exports data that needs to be translated to realworld values. In some cases we are translating switch positions to numerical data. Also this application needs to be able to listen on a UDP port for this data and transmit it out over serial. 3. Connect an arduino and write a simple sketch (code) to receive the data being received over the serial interface. Convert that data to electronic outputs (the LEDs). 4. Validate the data on your LEDs. Mk 1 Eyeball. Existing software/interface already exists, you shouldnt need to change this :) Step 1. Install HELIOS. Get it from here http://www.gadrocsworkshop.com/helios/. Run the setup. Open the profile editor. Click Profile Add interface Select DCS A10c. When the DCS A10C interface window opens, find the A-10 Setup section and click on Setup DCS A-10C This has now created an export.lua file on your file system. For me (Windows 8.1) its in this folder C:\Users\Joe\Saved Games\DCS\Scripts Open the export.lua in a text editor (I use Notepad++ http://notepad-plus-plus.org/download/v6.5.3.html - it has native lua support and will do syntax highlighting, but you can use notepad if you want) This file is the heart of the HELIOS app, it collates a huge amount of data from DCS and formats it for you. Then it sends it out as a UDP packet to a specific IP Address and Port endpoint. We are going to be incredibly cheeky and hitch hike on back of this wonderful script. Navigate to the bottom of the file and find this bit of code function FlushData() if #gSendStrings > 0 then local packet = gSimID .. table.concat(gSendStrings, ":") .. "\n" socket.try(c:sendto(packet, gHost, gPort)) gSendStrings = {} gPacketSize = 0 end end Add this line after socket.try..... socket.try(c:sendto(packet,gHost,65002)) so that it looks like this. function FlushData() if #gSendStrings > 0 then local packet = gSimID .. table.concat(gSendStrings, ":") .. "\n" socket.try(c:sendto(packet, gHost, gPort)) socket.try(c:sendto(packet,gHost,65002)) gSendStrings = {} gPacketSize = 0 end end Now save the file. ( If you want to send this to another server, change gHost in the 2nd socket.try to socket.try(c:sendto(packet,"192.168.1.5",65002)) Change the ip address to the one you want to send it to. When you start DCS and fly a mission you are now streaming 2 sets of data. One to HELIOS on port 9089, and another to port 65002. *CAVEAT* If you click that Setup DCS A10C button again it will rewrite your export.lua and you'll lose your changes so just remember to update it. You could follow the advice to use the 3rd party scripts function but for the life of me i couldnt get it to reliably work as everytime i used it HELIOS functionality would stop working and this is much easier and quicker for new starters. 2. OK next, lets create a UDP listener application. This is NOT hard, well not if you have someone to tell you how to do it :) First if you dont have Visual Studio, lets download it. Its free. http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop Install and run it. Select new project In the New Project dialog, select Visual C#\Windows from the Templates tree, and Windows Forms Application Enter a name, I called mine UDPListener (WindowsApplication1 isnt very catchy is it? Click OK. Click Toolbox label Click on the pin, it fixes the flyout window. In the form designer, resize the form dialog. Double its size. Do this by dragging one of the forms edges. In the toolbox click on All Windows Forms Scroll down until you find Textbox Click and drag onto the Form designer, should look like this On the right hand side is the Properties dialog. Click on the textbox you dragged onto the form. The context of the properties dialog changes to textBox1 Using the scrollbar dragdown until you find the Multiline entry. HINT there is a little button icon that allows you to sort all the properties Alphabetically. Look under the letter B in textBox. Click on False, a dropdown arrow appears, click on it. Select True. Your textbox changed slightly, it now has drag points on the corners Click the bottom right dragpoint and resize the textbox to half the forms width and height Ok now find Button in the toolbox and drop it on the form as well. Add three more buttons please. Click on each button in turn, and in the properties window find (name) if you sorted the list its at the top. Click on button1 and change it to buttonUDPON Now find the Text Property and set it to UDP ON. Your button has now changed to something a little more friendly. By amending the (Name) and Text properties do the following. Change button2 to buttonUDPOFF - UDP OFF Change button3 to buttonCOMON - COM ON and finally button4 to buttonCOMOFF - COM OFF UDP OFF and COM OFF wont fit on the buttonso resize them a touch until the text appears. Underneath the buttoms add another textbox, set the multiline option and resize it. Finally find SerialPort on the toolbox, its in the Components section. Drag that onto the form. You will see serialPort1 appear at the bottom of the form designer. Should look something like this.... In the Form Designer double click on Form1. The editor opens. Add the following lines (c# code is case sensitive so make sure you copy exactly) Under Form1() also added the following code private void SendSerialData(string function, string value) { if (COM) { string sendthis = "*" + function + "-" + value + "#"; char[] c = sendthis.ToCharArray(); serialPort1.Write(c, 0, c.Length); } } private void ProcessData( string data) { string[] d2 = data.Split( '='); if (d2.Length != 2) return; switch (d2[0]) { case "2251": // textBoxILS.Text = d2[1].ToString(); switch (d2[1].ToString().Substring(0, 3)) { case "0.0": SendSerialData( "101", "108" ); break; case "0.1": SendSerialData( "101", "109" ); break; case "0.2": SendSerialData( "101", "110" ); break; case "0.3": SendSerialData( "101", "111" ); break; default: break; } break; default: break; } } Click on the Form1.cs(design) tab at the top. Double click on UDP ON - this auto generate the click event for the button and open the code editor again. Add the following code so it looks like this. private void buttonUDPON_Click( object sender, EventArgs e) { done = false; UdpClient listener = new UdpClient(listenPort); IPEndPoint groupEP = new IPEndPoint (IPAddress .Any, listenPort); string received_data; byte[] receive_byte_array; try { while (!done) { receive_byte_array = listener.Receive( ref groupEP); received_data = Encoding.ASCII.GetString(receive_byte_array, 0, receive_byte_array.Length); if (received_data.Length > 0) textBox1.Text = ""; string[] r = received_data.Split( ':'); foreach ( string s in r) { ProcessData(s); textBox1.Text += s + Environment.NewLine; } Application.DoEvents(); } } catch ( Exception ex) { textBox1.AppendText(ex.ToString()); } listener.Close(); } Go back to the form editor and double click on the UDP OFF button to generate the click event. This one is easy. Add this line done = true; Ok this ends part 1, but wait we want to see this in action dont we? To test this start DCS, launch a mission - i normally sit on the tarmac in campaign mode. Once the game is running goto your VS session and click the green arrow. That will compile your code into a debug version. The form will open, click on UDP ON. All going well you're now receving a UDP stream direct from DCS!!! In part 2 i'll expand your app to use a serial port to communicate with your arduino(assuming you have one!) UDPListener.zip DCS_OUTPUT_TO_MULTIPLE_7SEG.zip