Home ยป Version 0.9 is live!

Version 0.9 is live!

by Bits and Droids
Published: Last Updated on 0 comment

Working on this update has been a struggle but I cleaned up some old code, added some new, and here it is. Version 0.9. for my mfs2020 flight sim connector. For all the changes head over to the release notes. In this post, I wanted to quickly share the code I’ve used in the update video.
There is a chance that the connector crashes if you’ve already got settings saved. This only seems to happen once!

Used or mentioned in this video:

Gear I use when building hardware

Flight gear I use

Dual-mode controller (Autopilot)

This code example isn’t the cleanest but it demonstrates what can be achieved. One board that sends and receives at the same time and only receives what you want it to receive. This makes it easier to create your own flight sim hardware on a single board.

#include<BitsAndDroidsFlightConnector.h>
BitsAndDroidsFlightConnector connector(false);
const byte btnA = 13;
const byte btnB = 11;
const byte btnC = 9;
const byte ledA = 12;
const byte ledB = 10;

byte btnALastState = HIGH;
byte btnBLastState = HIGH;
byte btnCLastState = HIGH;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(btnA, INPUT_PULLUP);
  pinMode(btnB, INPUT_PULLUP);
  pinMode(btnC, INPUT_PULLUP);
  pinMode(ledA, OUTPUT);
  pinMode(ledB, OUTPUT);  
}

void loop() {
  connector.dataHandling();
  bool apOn = connector.getAPMasterOn();
  if(apOn){
    digitalWrite(ledA, HIGH);
  } else if(!apOn){
    digitalWrite(ledA, LOW);
  }

  bool altLock = connector.getAPAltitudeLockOn();
  if(altLock){
    digitalWrite(ledB, HIGH);
  } else if(!altLock){
    digitalWrite(ledB, LOW);
  }
  
  byte curAState = digitalRead(btnA);
  if(curAState != btnALastState){
    if(curAState == LOW){
    Serial.println(connector.sendApMasterOn());
   
    }
     btnALastState = curAState;
    delay(200);
  }

  byte curBState = digitalRead(btnB);
  if(curBState != btnBLastState){

   if(curBState == LOW){
    Serial.println(connector.sendAPPanelAltitudeHold());
    
   }
   btnBLastState = curBState;
    delay(200);
  }

  byte curCState = digitalRead(btnC);
  if(curCState != btnCLastState){
    if(curCState == LOW){
    Serial.println(connector.sendApPanelHeadingLock());
   
    }
     btnCLastState = curCState;
    delay(200);
  }
  // put your main code here, to run repeatedly:

}

Throttle

#include <BitsAndDroidsFlightConnector.h>
BitsAndDroidsFlightConnector connector = BitsAndDroidsFlightConnector(true);
void setup() {
  Serial.begin(115200);

}
void loop() {
  connector.simpleInputHandling(A2);
  connector.mixtureInputHandling(A0,A0);
  connector.propsInputHandling(A1, A1);
}

You may also like

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept