Welcome to Cockpitbuilders.com. Please login or sign up.

April 18, 2024, 02:57:32 PM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
189 Guests, 0 Users
Members
  • Total Members: 4,154
  • Latest: xyligo
Stats
  • Total Posts: 59,640
  • Total Topics: 7,853
  • Online today: 184
  • Online ever: 582
  • (January 22, 2020, 08:44:01 AM)
Users Online
Users: 0
Guests: 189
Total: 189

COUNTDOWN TO WF2022


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

Arduino and X-Plane

Started by RayS, November 14, 2014, 02:12:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RayS

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-----------------



Ray Sotkiewicz

geneb

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.
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.

Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate