by Bits and Droids | 21-03-2023
Hi guys. I've added 5 new functions which can be found under the heading: "Available functions". You're now able to retrieve the current heading, speed in knots, vertical speed, altitude and GPS Ground speed???
When using an Uno or Mega it's important to pass a false boolean when creating the connector (BitsAndDroidsFlightConnector connector(false);). This will tell the system that an Uno is connected. Another thing to keep in mind is that it's important to place a 10Uf capacitor between the ground and reset pins on the board (https://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection/). The Uno resets when a serial connection is made. This would result in a constant state of receiving data <-> reset. When you upload a sketch you can just take the capacitor out (or else it won't upload) and reinsert it afterward.
These are the steps needed to get the library to work:
It still uses the latest connector which can be downloaded from www.bitsanddroids.com/downloads. In the example code, I've made use of an I2C Lcd display but you're able to display the data any way you like. The example code can be found in the Arduino IDE at File -> examples -> BitsAndDroidsFlightConnector (can be found at the Examples from custom libraries category).
Function | Action | Returns |
---|---|---|
.dataHandling() | Starts the serial monitoring and manages the data | Nothing |
.getIndicatedAirspeed() | returns current speed in Knots | String i.e. 200 |
.getIndicatedAltitude() | returns current altitude in feet | String i.e. -100 or 40000 |
.getIndicatedHeading() | returns current heading in degrees | String i.e. 240 |
.getIndicatedGPSGroundspeed() | you tell me? | String something |
.getTrueVerticalSpeed() | returns current vertical speed | i.e. -150 or 280 |
.getActiveCom1() | returns active com 1 | String i.e. 245.200 |
.getActiveCom2() | returns active com 2 | String i.e. 245.200 |
.getStandbyCom1() | returns standby com 1 | String i.e. 245.200 |
.getStandbyCom2() | returns standby com 2 | String i.e. 245.200 |
.getApVerticalSpeed() | returns ap vertical speed | String i.e. -1000 or 4500 |
.getApAltLock() | returns ap altitude lock | String i.e. 30000 |
.getKohlmanAltimeter() | returns kohlman/altimeter | String i.e. 29.92 This can be a weird duck ingame since sometimes it's the digital altimiter and sometimes the old school gauge |
.getBarPressure() | returns barometric pressure | String i.e. 2489 To be honest I have no clue what it actually represents didn't have time to investigate. |
Notice the small Serial.setTimeout(10)? You need to check for yourself if a bigger value is needed to increase stability.
//DONT FORGET TO ADD A 10Uf capacitor after installing the sketch between ground and the reset pin on the board
#include <BitsAndDroidsFlightConnector.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//create a new connector flase = Uno/Mega, True = Leonardo/Pro Micro
BitsAndDroidsFlightConnector connector(true);
//16x2 I2C display
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 20, 4);
void setup() {
lcd.init();
lcd.backlight();
//This can be left out if you use an Leonardo/Pro micro
Serial.begin(115200);
Serial.setTimeout(10);
}
void loop() {
//start the data processing
connector.dataHandling();
lcd.setCursor(0,0);
//retrieve active com 1 from the connector
lcd.print(connector.getIndicatedAirspeed());
lcd.setCursor(0,1);
//retrieve active com 2 from the connector
lcd.print(connector.getIndicatedAltitude());
lcd.setCursor(8,0);
//retrieve standby com 1 from the connector
lcd.print(connector.getIndicatedHeading());
lcd.setCursor(8,1);
//retrieve standby com 2 from the connector
lcd.print(connector.getIndicatedGPSGroundspeed());
lcd.setCursor(0,2);
//retrieve active com 1 from the connector
lcd.print(connector.getTrueVerticalSpeed());
lcd.setCursor(0,3);
//retrieve active com 2 from the connector
lcd.print(connector.getActiveCom1());
lcd.setCursor(8,2);
//retrieve standby com 1 from the connector
lcd.print(connector.getStandByCom1());
}
Now as always please let me know if you have any questions or if you'd like to receive more data from the game (you can leave them at my Youtube channel or send them to info@bitsanddroids.com). Suggestions and feedback are always welcome. Till next time!