Results 1 to 2 of 2
  1. #1
    New Member
    Join Date
    Apr 2013
    Location
    Australia
    Posts
    2
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Issues Regarding Auropilot functions

    Gday,

    I've just purchase my Arduino card today after about two weeks of research into home cockpit building. I have limited programming experience, but relearn reasonably fast. I was able to set up my board, due to newbie tutes, and then use some pre-made LINK2FS scripts (the "nose gear" one) with LINK2FS and one or two of my own. So its safe to say my card and components are set up, compiling and uploading correctly

    Then I ran into a problem.

    All I want to do is the following:

    - use LINK2FS com port output to be read by the card and light up an LED if autopilot is currently on (set as 'b' in LINK2FS)

    Seems simple enough but I just cant seem to get the code it to work. Below are two 'avenues' I tried. I tried about 50 iterations of the syntax, and even thought the 1 or 0 for 'b' was boolean at one point.

    I seem to remember coming across a list of working/broken LINK2FS outputs but cannot find it again. I have trawled through most of this board and been unable to find a solution.

    The string based one
    int xx;
    String apind, apindold;

    void setup() {
    Serial.begin(9600);

    pinMode(13, OUTPUT);

    }

    void loop() {
    if (Serial.available() > 0) {

    xx = Serial.read();

    if (xx = 'b') {
    delay (11);
    apind = "";
    apind += char(Serial.read());
    apind += char(Serial.read());
    if (apind != apindold) {
    if (apind == "b1") {
    delay (11);
    digitalWrite(13, HIGH);
    }
    if (apind == "b0") {
    delay (11);
    digitalWrite(13, LOW);
    }
    apindold = apind;
    }
    }
    }
    }
    and the int based one

    int apind = 1;
    int apindold = 0;

    void setup() {
    Serial.begin(9600);
    pinMode(13, OUTPUT);
    }

    void loop() {
    if (Serial.available() > 0) {
    apind = Serial.read();
    if (apind == 'b') {
    delay (11);
    apind = Serial.read();
    }
    if (apind != apindold) {
    if (apind = 1) {
    delay (11);
    digitalWrite(13, HIGH);
    }
    if (apind == 0) {
    delay (11);
    digitalWrite(13, LOW);
    }
    apindold = apind;
    }
    }
    }

  2. #2
    New Member
    Join Date
    Apr 2013
    Location
    Australia
    Posts
    2
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Issues Regarding Auropilot functions

    SOLVED, was just a syntax issue, or possibly a pin 13 issue.