FSX control of Servos for motion Platform
Moderators: adafruit_support_bill, adafruit

FSX control of Servos for motion Platform

by SamSpiteri on Thu Nov 01, 2012 11:54 pm

I intend to build a 2DOF flight Simulator Platform using initally two small servo motors. I am using Link2FS software by Jim to extract the Data from Flight Simulator X and intend to use Arduino Uno to drive two small servo's via a dedicated USB port.

Does anyone have a sketch to do this.

Sam
SamSpiteri
 
Posts: 2
Joined: Thu Nov 01, 2012 11:30 pm

Re: FSX control of Servos for motion Platform

by franklin97355 on Fri Nov 02, 2012 10:56 am

It would help if you added more detail. How does the program output the data to the serial port and what is the format of the data?
User avatar
franklin97355
 
Posts: 5517
Joined: Mon Apr 21, 2008 2:33 pm

Re: FSX control of Servos for motion Platform

by SamSpiteri on Wed Nov 07, 2012 8:35 pm

franklin97355 wrote:It would help if you added more detail. How does the program output the data to the serial port and what is the format of the data?


Franklin.

Thanks for the time. I intend to use link2fs software to output the data to the serial port. This enables me to select which output I need for the 2dof i.e. pitch and roll. I some how did this and can see the chart provide different outputs as FSX flies.

I am advised that the Arduino Uno can read this and with the correct sketch can drive two small servos.

I copied this sketch (below) from "Jim page NZ" but when I try to upload I receive a "char" to "const char" error message.

Not being a software person I am stumped.

Thanks in anticipation of any help.

Sam

// pitch
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.


#include <Servo.h>
Servo myservopitch;

int j1;
String pitch,pitchold;

void setup()
{
myservopitch.attach(9);
Serial.begin(115200);
}

void loop()
{
if(Serial.available()>0){
j1= Serial.read();
if(j1=='A'){
delay(5);
pitch =char(Serial.read());
pitch+=char(Serial.read());
pitch+=char(Serial.read());
pitch+=char(Serial.read());
pitch+=char(Serial.read());
pitch+=char(Serial.read());
if(pitch!=pitchhold){
char carray[9];
pitch.toCharArray(carray,sizeof(carray));
int n=ato(carray);
n=map(n,-90,90,0,179);
myservopitch.write(n);
pitchold=pitch;
}
}
SamSpiteri
 
Posts: 2
Joined: Thu Nov 01, 2012 11:30 pm

Re: FSX control of Servos for motion Platform

by Jim NZ on Wed Nov 28, 2012 4:19 pm

Sam,,
You are trying to use a PDE that was written in Arduino IDE version 0022 but it wont compile in the later IDE's.
Most of my stuff has been updated so it works on version 0022 right thru to the latest version 1.1 so download a later PDE and see how you go.
All the newer stuff is available here ,,
Jimspage.co.nz/intro.htm


Good luck and have fun ,,, Jim
Jim NZ
 
Posts: 1
Joined: Wed Nov 28, 2012 4:11 pm

Re: FSX control of Servos for motion Platform

by Snuffy63 on Mon Dec 02, 2013 4:13 pm

did you ever have any luck... I'm trying to set up a 2dof sim myself and using wiper motors. I have an uno and a l293d motor board but no sketches or any idea how to interface with fsx... Good luck...
Snuffy63
 
Posts: 6
Joined: Fri Nov 29, 2013 8:14 pm