Cockpitbuilders.com

Arduino Projects => General Discussions => Topic started by: RayS on November 14, 2014, 02:12:13 PM

Title: Arduino and X-Plane
Post by: RayS on November 14, 2014, 02:12:13 PM
Anyone using Arduino with X-Plane?

Specifically: I'm using the ARDref libraries so I can see UDP across the wires (No need to connect to an IP address)

I have my "out_1.cfg" file written to send just the flap position over UDP

My Arduino code is stupid-simple (I will post it here later tonight) but I just can't get it to read any data. All ports are set up correctly, as well as the ARDref port.

All I get on my Serial Port Monitor are a bunch of big fat zeros.

Anyone else doing this?


#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <util.h>
#include <SPI.h>         
#include <Wire.h>
#include <XP_ARDref.h>         // -- include XPlane ARDref library
//==============================================
byte Ard_MAC[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEF};// MAC-Address of Arduino
int ARP = 5080;                                  // ARDref port
int XPR = 49001;                                 // XPlane port
int XPW = 49000;                                 // XPlane port (for direct data exchange )
//==============================================

ARDref XP (ARP, XPR, XPW, Ard_MAC);   //==!==  Create  XPlaneData object (XP)
//----------------------------------------------------

//-------------------------------------
void setup()  {
  Serial.begin(9600);       // init serial port
  XP.begin(1);   //init, use Number of this Arduino ( if you use more than one board, choose 2, 3.. etc)
//-------------------------------------   
}

//================================================
void loop() { 
 
  XP.GetDataP();   //this function must be in each loop , for X-Plane data reading
//------------------------ Read data from X-Plane


// -- you can use data for output on this "master" Arduino  or re-send them to slave for output:
   
  //float Val1 = XP.DataOut[1];  // Get value of chosen parameter (#5 from your "out_1.cfg" list)
    Serial.print("Flaps: ");
    Serial.println(XP.DataOut[1]);     
    delay(1000);
}   //-- End-----------------



Title: Re: Arduino and X-Plane
Post by: geneb on November 24, 2014, 01:15:16 PM
Ray, grab a copy of WireShark and use it to see exactly what XP is transmitting across the wire.  That'll tell you for certain where the issue likely lies.

g.