
22 May FMS RC Simulator
I’ve been searching the internet for a way to use Arduino as a sim cable to use FMS instead of having to buy a ready made cable
FMS
and I’ve came by these links:
–Arduino as flight simulator interface for any rc receiver
–2.4Ghz Radio to Flight Simulator Interface Using Arduino
I tried the code in the first link and it worked just fine, but I didn’t like the code, It was a mess. so I wrote the following code and tested it using 3 different Transmitters/Receivers, and it works like a charm.
#define RX_SIGNAL_TIMEOUT 20000
#define CHANNEL1_INPUT 8
#define NUM_OF_RXCHANNELS 4
unsigned long duration;
void setup()
{
Serial.begin(9600);
for(int i = CHANNEL1_INPUT; i < NUM_OF_RXCHANNELS + CHANNEL1_INPUT; i++) { pinMode(i,INPUT); } } void loop() { Serial.print((char)(0xF0+NUM_OF_RXCHANNELS)); Serial.print((char)0); for(int i = CHANNEL1_INPUT; i < NUM_OF_RXCHANNELS + CHANNEL1_INPUT; i++) { duration = pulseIn(i,HIGH,RX_SIGNAL_TIMEOUT); Serial.print((char)map(duration,900,2100,50,239)); } delay(5); }