I've got to a point in my project where I need a hand to be pointed in the right direction for a half decent tutorial... There are lots of tutorials out there, but I'm unsure where to follow for my specific requirements.
I have a very nice control stick, with two precision potentiometers (this came from an air force F16 pilot reaction training bench). You might say why not just get a USB stick? Well, all of my projects are done ona close to £zero budget, and a friend gave me this stick, so I plan to use it.
I have wired it to an Arduino Uno, and can successfully send the positions to the serial monitor on my Linux Mint PC.
Now, how best to get this data into Flightgear? How should I arrange the string of data from the Arduino to be read by flightgear? What range does flightgear expect analogue data to arrive in? I'd imagine 8 bit (256 values) would be plenty?
Once read by flightgear, how do I get it to be used for Pitch and Roll?
My very simple beginnings of the Arduino sketch so far:
- Code: Select all
/*
Flightgear hardware integration 01: Stick X and Y only so far.
Scott Bouchard UK www.scottbouch.com 24-01-2017
*/
const int xaxis = A0; //Define stick x input
const int yaxis = A1; //Define stick y input
int roll = 510; //Start roll (x) central, real world resting point
int pitch = 506; //Start pitch (y) central, real world resting point
void setup() {
Serial.begin(9600);
}
void loop() {
roll = analogRead(xaxis);
pitch = analogRead(yaxis);
Serial.println(pitch);
delay(500);
}
I also plan to add another analogue for a basic rudder bar, and two for throttles. The Stick also has a trigger and 4 way trim hat switch which I'd like to eventually use too, but thought I'd start with the basics first.
I must point out that I've had a play with a few arduino projects before, but am still learning, but I have never messed about with the guts of FGFS, so guidance will need to be fairly explicit for me if possible.
Many thanks in advance,
Cheers, Scott