Results 1 to 7 of 7
  1. #1
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Oct 2014
    Location
    Las Vegas, Nv.
    Posts
    8
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Problem modifing Multi-radio sketch

    Void question and void lessthan only allows 1 case switch. When second switch added sketch will not compile. Either switch code can be commented out and other switch works. Any help correcting this would be greatly appreciated.

  2. #2
    150+ Forum Groupie
    Join Date
    Nov 2013
    Location
    Evansville, Indiana
    Posts
    243
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Problem modifing Multi-radio sketch

    Don't forget a break; at the end of each case.

    ~fess
    I will only ever be, half the Geek that I wished I was.
    TheGeekForge.Com

  3. #3
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Oct 2014
    Location
    Las Vegas, Nv.
    Posts
    8
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Problem modifing Multi-radio sketch

    Breaks are both there. I can comment out one and the other works. Thanks

  4. #4
    150+ Forum Groupie
    Join Date
    Nov 2013
    Location
    Evansville, Indiana
    Posts
    243
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Problem modifing Multi-radio sketch

    Make sure you have semicolons and brackets set correctly...

    Code:
    void EQUALS()  
    {    // The first identifier was "="
        CodeIn = getChar();     // Get another character
        switch(CodeIn) 
        { 
        case 'a':    //  AP active
            Digit = "";
            Digit += getChar(); 
            if (Digit == "1")
            {
                digitalWrite(57, HIGH);
            }
            else
            {
                digitalWrite(57, LOW);
            }
        break;
        case 't':    //  AP AutoThrottle armed on/off  
            Digit = "";
            Digit += getChar();
            AP_AutoThrottle_arm = Digit.toInt();
            if (AP_AutoThrottle_arm == 1 )
            {
                digitalWrite(69, HIGH);
            }
            else
            {
                digitalWrite(69, LOW);
            }
        break;
        
        
                // etc etc etc
                // You only need the "Case" testing for the identifiers you expect to use.
        }    // End of Switch case
    }    // End of EQUALS() Function
    ~Fess
    I will only ever be, half the Geek that I wished I was.
    TheGeekForge.Com

  5. #5
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Oct 2014
    Location
    Las Vegas, Nv.
    Posts
    8
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Problem modifing Multi-radio sketch

    Thanks Fess_ter, I really appreciate your help. Here is the code in question.

    void QUESTION(){ // The first identifier was "?"
    delay (11);
    CodeIn = getChar(); // Get the second identifier
    switch(CodeIn) {// Now lets find what to do with it
    /* case 'Z'://Found the "Rud Trim"
    delay (11);
    trd = "";
    trd += getChar();
    trd += getChar();
    trd += getChar();
    trd += getChar();
    trd += (""); //pads it up to 8 caracters
    if (trd != trdold && digitalRead(22) == LOW) {
    delay (11);
    lcd.setCursor(9, 1);
    delay (11);
    lcd.print(trd);
    trdold = trd;}
    break;
    }*/
    case 'k'://Found the "Kohlsman"
    delay (11);
    klm = "";
    klm += getChar();
    klm += getChar();
    klm += getChar();
    klm += getChar();
    klm += getChar();
    klm += (""); //pads it up to 8 caracters
    if (klm != klmold && digitalRead(23) == LOW) {
    delay (11);
    lcd.setCursor(5, 1);
    delay (11);
    lcd.print(klm);
    klmold = klm;}
    break;
    }
    }// end of question void

    As is the case 'k' works and the file compiles, if I take out the "comments" (/* */) the file will not compile, if I then comment out the case 'k' section the case 'Z' works and the file again complies.
    I am currently running I.D.E 1.6.9 and using a mega 2650 r3. This only happens in "?" an the "<" voids.

  6. #6
    150+ Forum Groupie
    Join Date
    Nov 2013
    Location
    Evansville, Indiana
    Posts
    243
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Problem modifing Multi-radio sketch

    You had and extra end bracket. I remarked out the delay(11)s as well, you shouldn't need them.
    I also tabbed the code for readability.

    Try this...

    Code:
    void QUESTION()
    { // The first identifier was "?"
        //delay (11);
        CodeIn = getChar(); // Get the second identifier
        switch(CodeIn) // Now lets find what to do with it 
        {
        case 'Z'://Found the "Rud Trim"
            //delay (11);
            trd = "";
            trd += getChar();
            trd += getChar();
            trd += getChar();
            trd += getChar();
            trd += (""); //pads it up to 8 caracters 
            if (trd != trdold && digitalRead(22) == LOW) 
            {
                //delay (11);
                lcd.setCursor(9, 1);
                //delay (11);
                lcd.print(trd);
                trdold = trd;
            }
        break;
    
    
        case 'k'://Found the "Kohlsman"
            //delay (11);
            klm = "";
            klm += getChar();
            klm += getChar();
            klm += getChar();
            klm += getChar();
            klm += getChar();
            klm += (""); //pads it up to 8 caracters 
            if (klm != klmold && digitalRead(23) == LOW) 
            {
                //delay (11);
                lcd.setCursor(5, 1);
                //delay (11);
                lcd.print(klm);
                klmold = klm;
            }
        break;
        } 
    }// end of question void
    ~Fess
    I will only ever be, half the Geek that I wished I was.
    TheGeekForge.Com

  7. #7
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Oct 2014
    Location
    Las Vegas, Nv.
    Posts
    8
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Problem modifing Multi-radio sketch

    That worked. Thanks again and I am like your tag line. Now to work out the rest of the bugs. Thanks again