Over the past few months, I've been working hard to revamp the old Flight Connector. The new Flight Connector is more stable and easier to use, and it received a visual overhaul so that it does not look like an application from the Stone Age.
MakSO, a partner who has been hard at work on the connector has recorded a tutorial on how to get started with the Flight Connector. In this video, he goes over three topics: sending data to the sim, receiving data from the sim, and creating custom commands.
In the tutorial, MakSO uses three examples to explain the inner workings of the Flight Connector.
\* These are affiliate links that help support this site
In the first example, MakSo explains the basic structure of an Arduino sketch that imports the Flight Connector library.
cpp#include <Arduino.h> #include <Wire.h> #include <BitsAndDroidsFlightConnector.h> #include <LiquidCrystal_I2C.h> //For LCD #include <OneButton.h> #include <Encoder.h> //This creates an instance of the connector library. //adding this line exposes many helper functions to make your life easier. BitsAndDroidsFlightConnector connector = BitsAndDroidsFlightConnector(); void setup() { //To initialize the Serial communication the library uses to //talk to the connector. Serial.begin(115200); } void loop() { //This line is responsible for communication with the //Flight Conenctor when you want to receive data from the sim. //It can be removed if you only want to send data to the sim. connector.dataHandling(); }
In the second example, he goes into the topic of triggering events in the sim from your controller.
cpp#include <Arduino.h> #include <Wire.h> #include <BitsAndDroidsFlightConnector.h> #include <LiquidCrystal_I2C.h> //For LCD #include <OneButton.h> #include <Encoder.h> //Here we create an instance of the Encoder library Encoder enc(2,3); int encInt = 0 ; long oldPositionInt = -999; OneButton encButton(4); bool Mhz = true; //Just like our first example we initialize an instance of the Connector library class BitsAndDroidsFlightConnector connector = BitsAndDroidsFlightConnector(); void setup() { Serial.begin(115200); encButton.attachClick([]() { //change from K to M change Mhz = !Mhz; }); encButton.attachDoubleClick([]() { //swap stdby and active connector.send(sendSwapCom1); }); } void loop() { //This line could be left out in this example. //It will be needed in the next example so we leave it in for now connector.dataHandling(); encButton.tick(); long newPositionInt = enc.read(); if(newPositionInt != oldPositionInt){ if(newPositionInt>oldPositionInt){ //turned left oldPositionInt = newPositionInt; if(newPositionInt%4==0){ if(Mhz){ //Send the command to decrease the Mhz freq connector.send(sendCom1WholeDec); } else{ //Send the command to decrease the Khz freq connector.send(sendCom1FractDecr); } delay(1); } } else{ //turned right oldPositionInt = newPositionInt; if(newPositionInt%4==0){ if(Mhz){ //Send the command to increase the Mhz freq connector.send(sendCom1WholeInc); } else{ //Send teh command to increase the Khz freq connector.send(sendCom1FractInc); } delay(1); } } } }
In the last example, he explains how data can be displayed on an LCD screen sent from the simulator.
cpp#include <LiquidCrystal_I2C.h> #include <BitsAndDroidsFlightConnector.h> #include <OneButton.h> #include <Encoder.h> #include <ezButton.h> Encoder enc(2,3); int encInt = 0 ; long oldPositionInt = -999; OneButton encButton(4); bool Mhz = true; //Create an instance of the LCD library //This enables us to display the data we want LiquidCrystal_I2C lcd(0x27, 16, 2); //Create an instance of the Flight Connector library BitsAndDroidsFlightConnector connector = BitsAndDroidsFlightConnector(); void setup() { // put your setup code here, to run once: lcd.init(); lcd.backlight(); Serial.begin(115200);; lcd.setCursor(0,0); lcd.print("Active: "); lcd.setCursor(8,0); lcd.print("125.222"); lcd.setCursor(0,1); lcd.print("Stdby: "); lcd.setCursor(8,1); lcd.print("129.111"); encButton.attachClick([]() { //change from K to M change Mhz = !Mhz; }); encButton.attachDoubleClick([]() { //swap stdby and active connector.send(sendSwapCom1); }); } void loop() { //This line communicates with the connector. //It continiously checks if new data is available. connector.dataHandling(); encButton.tick(); lcd.setCursor(8,0); //Print the active com 1 frequency that has been received last from the connector. String active = String(connector.getActiveCom1()); lcd.print(active.substring(0,3)+String(".")+active.substring(3,6)); lcd.setCursor(8,1); //Print the standby com 1 freqyency that has been received last from the connector. String stdby = String(connector.getStandbyCom1()); lcd.print(stdby.substring(0,3)+String(".")+stdby.substring(3,6)); long newPositionInt = enc.read(); if(newPositionInt != oldPositionInt){ if(newPositionInt>oldPositionInt){ //turned left oldPositionInt = newPositionInt; if(newPositionInt%4==0){ if(Mhz){ connector.send(sendCom1WholeDec); } else{ connector.send(sendCom1FractDecr); } delay(1); } } else{ //turned right oldPositionInt = newPositionInt; if(newPositionInt%4==0){ if(Mhz){ connector.send(sendCom1WholeInc); } else{ connector.send(sendCom1FractInc); } delay(1); } } } }
As always, thanks for the support so far. If you've got great ideas or encounter a bug please open an issue on GitHub or join our Disord