Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    500+ This must be a daytime job



    Join Date
    Jan 2009
    Location
    Tampa
    Posts
    527
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    TFT LCD Touch-Screen Radio Sketch

    I've had several requests for this sketch. It's hacked together from some demo code and other stuff I was doing. It has some bugs, please repost when you fix or add stuff! I added to the file library, but I will also post here for easy cut and paste. Here's a link to the demo on youtube:

    https://www.youtube.com/watch?v=t-1TVk_y9v8


    CODE:

    // UTFT_Buttons_Demo_320x240 (C)2013 Henning Karlsen
    // web: http://www.henningkarlsen.com/electronics
    //
    // A small demo to demonstrate the use of some of the
    // functions of the UTFT_Buttons add-on library.
    //
    // This demo was made for modules with a screen resolution
    // of 320x240 pixels, but should work on larger screens as
    // well.
    //
    // This program requires both the UTFT and UTouch libraries
    // in addition to the UTFT_Buttons add-on library.
    //


    #include
    #include
    #include


    // Declare which fonts we will be using
    extern uint8_t SmallFont[];
    extern uint8_t BigFont[];
    extern uint8_t Dingbats1_XL[];
    extern uint8_t SevenSegNumFontPlus[];
    extern uint8_t SevenSegmentFull[];



    // Standard Arduino Mega/Due shield : ,38,39,40,41
    // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28


    // Remember to change the model parameter to suit your display module!
    UTFT myGLCD(ITDB32S,38,39,40,41);


    // Set up UTouch...
    // Set the pins to the correct ones for your development board
    // -----------------------------------------------------------
    // Standard Arduino 2009/Uno/Leonardo shield : 15,10,14,9,8
    // Standard Arduino Mega/Due shield : 6,5,4,3,2
    // CTE TFT LCD/SD Shield for Arduino Due : 6,5,4,3,2
    // Standard chipKit Uno32/uC32 : 20,21,22,23,24
    // Standard chipKit Max32 : 62,63,64,65,66
    // AquaLEDSource All in One Super Screw Shield : 62,63,64,65,66
    UTouch myTouch(6,5,4,3,2);


    // Finally we set up UTFT_Buttons


    int CodeIn;// used on all serial reads
    String com1_freq, com1_freq_old;
    String com1_stby, com1_stby_old;


    String com2_freq, com2_freq_old;
    String com2_stby, com2_stby_old;


    String nav1_freq, nav1_freq_old;
    String nav1_stby, nav1_stby_old;


    String nav2_freq, nav2_freq_old;
    String nav2_stby, nav2_stby_old;


    String adf, adf_old;
    String xpdr, xpdr_old;


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

    myGLCD.InitLCD();
    myGLCD.clrScr();
    myGLCD.setFont(BigFont);


    myTouch.InitTouch();


    myTouch.setPrecision(PREC_MEDIUM);


    }


    void loop()
    {


    main_page();
    //tuning_menu();
    } // end void loop



    void tuning_menu()
    {
    int but1, but2, but3, but4,but5, but6, but7, but9, butX, butY, pressed_button;
    boolean default_colors = true;

    UTFT_Buttons myButtons(&myGLCD, &myTouch);
    myGLCD.clrScr();

    delay(100);
    myButtons.setTextFont(BigFont);
    myButtons.setSymbolFont(Dingbats1_XL);

    but1 = myButtons.addButton( 10, 20, 100, 30, "COM1");
    but2 = myButtons.addButton( 150, 20, 100, 30, "COM2");
    but3 = myButtons.addButton( 10, 60, 100, 30, "NAV1");
    but4 = myButtons.addButton( 150, 60, 100, 30, "NAV2");
    but5 = myButtons.addButton( 10, 100, 100, 30, "XPDR");
    but6 = myButtons.addButton( 10, 140, 100, 30, "ADF");
    but7 = myButtons.addButton( 150, 100, 100, 30, "A/P");
    but9 = myButtons.addButton( 10, 180, 100, 30, "MAIN");


    myButtons.drawButtons();







    while(1)
    {
    if (myTouch.dataAvailable() == true)
    {
    pressed_button = myButtons.checkButtons();



    if (pressed_button==but1)
    com1_cfg();

    if (pressed_button==but2)
    com2_cfg();


    if (pressed_button==but3)
    nav1_cfg();

    if (pressed_button==but4)
    nav2_cfg();

    if (pressed_button==but5)
    xpdr_cfg();

    if (pressed_button==but9) {
    int dummy=1;
    main_page();
    }
    break;





    } // end if
    } // end while
    } // end main menu


    void main_page()
    {

    // come here to display the main page
    // show all radio frequencies, and give
    // a button to jump to tuning_menu
    myGLCD.clrScr();
    myGLCD.setFont(BigFont);
    myGLCD.setColor(VGA_WHITE);
    myGLCD.setBackColor(VGA_BLACK);
    myGLCD.print("COM1 ", 0, 0);
    myGLCD.print("COM2 ", 0, 55);
    myGLCD.print("NAV1 ", 0, 110);
    myGLCD.print("NAV2 ", 0, 165);
    //myGLCD.print("XPDR ", 0, 80);
    //myGLCD.print("ADF ", 0, 100);



    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com1_freq, 70, 0);
    myGLCD.print(com2_freq, 70, 55);
    myGLCD.print(nav1_freq, 70, 110);
    myGLCD.print(nav2_freq, 70, 165);

    int but1m, pressed_button;


    UTFT_Buttons myButtonsm(&myGLCD, &myTouch);
    myButtonsm.setTextFont(BigFont);
    myButtonsm.setSymbolFont(Dingbats1_XL);

    but1m = myButtonsm.addButton( 0, 190, 40, 40, "w", BUTTON_SYMBOL);
    myButtonsm.drawButtons();



    while(1) {



    if (Serial.available()) {
    CodeIn = getChar();
    if (CodeIn == '=') {EQUALS();} // The first identifier is "="
    if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
    if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
    if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
    }

    if (myTouch.dataAvailable() == true)
    {
    pressed_button = myButtonsm.checkButtons();
    if (pressed_button==but1m)
    tuning_menu();
    break;
    //myGLCD.print("Button 1", 110, 220);
    } // end if

    if (com1_freq != com1_freq_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com1_freq, 70, 0);
    com1_freq_old = com1_freq;
    }

    if (com2_freq != com2_freq_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com2_freq, 70, 55);
    com2_freq_old = com2_freq;
    }

    if (nav1_freq != nav1_freq_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(nav1_freq, 70, 110);
    nav1_freq_old = nav1_freq;
    }

    if (nav2_freq != nav2_freq_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.print(nav2_freq, 70, 165);
    nav2_freq_old = nav2_freq;
    }
    }
    }



    char getChar()// Get a character from the serial buffer
    {
    while(Serial.available() == 0);// wait for data
    return((char)Serial.read());// Thanks Doug
    }


    void EQUALS(){
    CodeIn = getChar(); // Get the second identifier
    xpdr_old = "";
    switch(CodeIn) {// Now lets find what to do with it

    case 'A': // found Com1 frequency
    delay (11);
    com1_freq = "";
    com1_freq += getChar();
    com1_freq += getChar();
    com1_freq += getChar();
    com1_freq += getChar();
    com1_freq += getChar();
    com1_freq += getChar();
    com1_freq += getChar();
    break;

    case 'B': // found Com1 STBY frequency
    delay (11);
    com1_stby = "";
    com1_stby += getChar();
    com1_stby += getChar();
    com1_stby += getChar();
    com1_stby += getChar();
    com1_stby += getChar();
    com1_stby += getChar();
    com1_stby += getChar();
    break;

    case 'C': // found Com2 frequency
    delay (11);
    com2_freq = "";
    com2_freq += getChar();
    com2_freq += getChar();
    com2_freq += getChar();
    com2_freq += getChar();
    com2_freq += getChar();
    com2_freq += getChar();
    com2_freq += getChar();
    break;

    case 'D': // found Com2 STBY frequency
    delay (11);
    com2_stby = "";
    com2_stby += getChar();
    com2_stby += getChar();
    com2_stby += getChar();
    com2_stby += getChar();
    com2_stby += getChar();
    com2_stby += getChar();
    com2_stby += getChar();
    break;


    case 'E': // found Nav1 frequency
    delay (11);
    nav1_freq = "";
    nav1_freq += getChar();
    nav1_freq += getChar();
    nav1_freq += getChar();
    nav1_freq += getChar();
    nav1_freq += getChar();
    nav1_freq += getChar();
    break;

    case 'F': // found Nav1 STBY frequency
    delay (11);
    nav1_stby = "";
    nav1_stby += getChar();
    nav1_stby += getChar();
    nav1_stby += getChar();
    nav1_stby += getChar();
    nav1_stby += getChar();
    nav1_stby += getChar();
    break;

    case 'G': // found Nav2 frequency
    delay (11);
    nav2_freq = "";
    nav2_freq += getChar();
    nav2_freq += getChar();
    nav2_freq += getChar();
    nav2_freq += getChar();
    nav2_freq += getChar();
    nav2_freq += getChar();
    break;

    case 'H': // found Nav2 STBY frequency
    delay (11);
    nav2_stby = "";
    nav2_stby += getChar();
    nav2_stby += getChar();
    nav2_stby += getChar();
    nav2_stby += getChar();
    nav2_stby += getChar();
    nav2_stby += getChar();
    break;


    case 'J': // found xpdr frequency
    delay (11);
    xpdr = "";
    xpdr += getChar();
    xpdr += getChar();
    xpdr += getChar();
    xpdr += getChar();
    break;



    case 'I': // found adf frequency
    delay (11);
    adf = "";
    adf += getChar();
    adf += getChar();
    adf += getChar();
    adf += getChar();
    adf += getChar();
    adf += getChar();
    break;
    }//end of case switch
    }// end of void equals


    void LESSTHAN(){ // The first identifier was "<"
    CodeIn = getChar(); // Get another character
    switch(CodeIn) {// Now lets find what to do with it
    case 'D'://Found the second identifier = A for Altitude


    break;

    case 'B':
    //Do something
    break;

    }//end of case method
    }//end of lessthan


    void QUESTION(){ // The first identifier was "?"
    //do something
    }// end of question


    void SLASH(){ // The first identifier was "/" (Annunciator)
    //Do something
    }



    void com1_cfg()
    {
    int butcom1_cfg1, butcom1_cfg2, butcom1_cfg3, butcom1_cfg4, butcom1_cfg5, butcom1_cfg6, butcom1_cfg9, butX, butY, pressed_button;
    UTFT_Buttons myButtonsc1(&myGLCD, &myTouch);
    myGLCD.clrScr();
    delay(100);
    myButtonsc1.setTextFont(BigFont);
    myButtonsc1.setSymbolFont(Dingbats1_XL);
    butcom1_cfg1 = myButtonsc1.addButton( 120, 120, 50, 50, "+");
    butcom1_cfg2 = myButtonsc1.addButton( 120, 180, 50, 50, "-");
    butcom1_cfg3 = myButtonsc1.addButton( 250, 120, 50, 50, "+");
    butcom1_cfg4 = myButtonsc1.addButton( 250, 180, 50, 50, "-");
    butcom1_cfg5 = myButtonsc1.addButton( 0, 120, 50, 50, "<>");
    butcom1_cfg9 = myButtonsc1.addButton( 0, 180, 50, 50, "BK");

    myGLCD.setFont(BigFont);
    myGLCD.setColor(VGA_WHITE);
    myGLCD.setBackColor(VGA_BLACK);
    myGLCD.print("COM1 ", 0, 0);
    myGLCD.print("STBY ", 0, 55);

    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com1_freq, 70, 0);
    myGLCD.print(com1_stby, 70, 55);

    myButtonsc1.drawButtons();

    while(1) {
    if (Serial.available()) {
    CodeIn = getChar();
    if (CodeIn == '=') {EQUALS();} // The first identifier is "="
    if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
    if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
    if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
    }
    if (myTouch.dataAvailable() == true) {
    pressed_button = myButtonsc1.checkButtons();

    if (pressed_button==butcom1_cfg1)
    Serial.println("A02"); // send A02 to FSX for COM1 INC by 1 MHZ
    if (pressed_button==butcom1_cfg2)
    Serial.println("A01"); // send A01 to FSX for COM1 DEC by 1 MHZ
    if (pressed_button==butcom1_cfg3)
    Serial.println("A04"); // send A04 to FSX for COM1 INC by 25 kHZ
    if (pressed_button==butcom1_cfg4)
    Serial.println("A03"); // send A03 to FSX for COM1 DECC by 25 kHZ
    if (pressed_button==butcom1_cfg5)
    Serial.println("A06"); // send A03 o FSX for swapping COM1 with COM1 STBY
    if (pressed_button==butcom1_cfg9)
    tuning_menu();

    } // end if

    if (com1_freq != com1_freq_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com1_freq, 70, 0);
    com1_freq_old = com1_freq;
    }

    if (com1_stby != com1_stby_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com1_stby, 70, 55);
    com1_stby_old = com1_stby;
    }
    }
    }


    void com2_cfg()
    {
    int butcom2_cfg1, butcom2_cfg2, butcom2_cfg3, butcom2_cfg4, butcom2_cfg5, butcom2_cfg6, butcom2_cfg9, butX, butY, pressed_button;
    UTFT_Buttons myButtonsc2(&myGLCD, &myTouch);
    myGLCD.clrScr();
    delay(100);
    myButtonsc2.setTextFont(BigFont);
    myButtonsc2.setSymbolFont(Dingbats1_XL);
    butcom2_cfg1 = myButtonsc2.addButton( 120, 120, 50, 50, "+");
    butcom2_cfg2 = myButtonsc2.addButton( 120, 180, 50, 50, "-");
    butcom2_cfg3 = myButtonsc2.addButton( 250, 120, 50, 50, "+");
    butcom2_cfg4 = myButtonsc2.addButton( 250, 180, 50, 50, "-");
    butcom2_cfg5 = myButtonsc2.addButton( 0, 120, 50, 50, "<>");
    butcom2_cfg9 = myButtonsc2.addButton( 0, 180, 50, 50, "BK");

    myGLCD.setFont(BigFont);
    myGLCD.setColor(VGA_WHITE);
    myGLCD.setBackColor(VGA_BLACK);
    myGLCD.print("COM2 ", 0, 0);
    myGLCD.print("STBY ", 0, 55);

    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com2_freq, 70, 0);
    myGLCD.print(com2_stby, 70, 55);

    myButtonsc2.drawButtons();

    while(1) {
    if (Serial.available()) {
    CodeIn = getChar();
    if (CodeIn == '=') {EQUALS();} // The first identifier is "="
    if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
    if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
    if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
    }
    if (myTouch.dataAvailable() == true) {
    pressed_button = myButtonsc2.checkButtons();

    if (pressed_button==butcom2_cfg1)
    Serial.println("A08"); // send A08 to FSX for COM2 INC by 1 MHZ
    if (pressed_button==butcom2_cfg2)
    Serial.println("A07"); // send A07 to FSX for COM2 DEC by 1 MHZ
    if (pressed_button==butcom2_cfg3)
    Serial.println("A10"); // send A10 to FSX for COM2 INC by 25 kHZ
    if (pressed_button==butcom2_cfg4)
    Serial.println("A09"); // send A09 to FSX for COM2 DEC by 25 kHZ
    if (pressed_button==butcom2_cfg5)
    Serial.println("A12"); // send A12 to FSX for swapping COM2 with COM2 STBY
    if (pressed_button==butcom2_cfg9)
    tuning_menu();

    } // end if

    if (com2_freq != com2_freq_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com2_freq, 70, 0);
    com2_freq_old = com2_freq;
    }

    if (com2_stby != com2_stby_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(com2_stby, 70, 55);
    com2_stby_old = com2_stby;
    }
    }
    }



    void nav1_cfg()
    {
    int butnav1_cfg1, butnav1_cfg2, butnav1_cfg3, butnav1_cfg4, butnav1_cfg5, butnav1_cfg6, butnav1_cfg9, butX, butY, pressed_button;
    UTFT_Buttons myButtonsn1(&myGLCD, &myTouch);
    myGLCD.clrScr();
    delay(100);
    myButtonsn1.setTextFont(BigFont);
    myButtonsn1.setSymbolFont(Dingbats1_XL);
    butnav1_cfg1 = myButtonsn1.addButton( 120, 120, 50, 50, "+");
    butnav1_cfg2 = myButtonsn1.addButton( 120, 180, 50, 50, "-");
    butnav1_cfg3 = myButtonsn1.addButton( 250, 120, 50, 50, "+");
    butnav1_cfg4 = myButtonsn1.addButton( 250, 180, 50, 50, "-");
    butnav1_cfg5 = myButtonsn1.addButton( 0, 120, 50, 50, "<>");
    butnav1_cfg9 = myButtonsn1.addButton( 0, 180, 50, 50, "BK");

    myGLCD.setFont(BigFont);
    myGLCD.setColor(VGA_WHITE);
    myGLCD.setBackColor(VGA_BLACK);
    myGLCD.print("NAV1 ", 0, 0);
    myGLCD.print("STBY ", 0, 55);

    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(nav1_freq, 70, 0);
    myGLCD.print(nav1_stby, 70, 55);

    myButtonsn1.drawButtons();

    while(1) {
    if (Serial.available()) {
    CodeIn = getChar();
    if (CodeIn == '=') {EQUALS();} // The first identifier is "="
    if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
    if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
    if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
    }
    if (myTouch.dataAvailable() == true) {
    pressed_button = myButtonsn1.checkButtons();

    if (pressed_button==butnav1_cfg1)
    Serial.println("A14"); // send A14 to FSX for NAV1 INC by 1 MHZ
    if (pressed_button==butnav1_cfg2)
    Serial.println("A13"); // send A13 to FSX for NAV1 DEC by 1 MHZ
    if (pressed_button==butnav1_cfg3)
    Serial.println("A16"); // send A16 to FSX for NAV1 INC by 25 kHZ
    if (pressed_button==butnav1_cfg4)
    Serial.println("A15"); // send A15 to FSX for NAV1 DEC by 25 kHZ
    if (pressed_button==butnav1_cfg5)
    Serial.println("A18"); // send A18 to FSX for swapping NAV1 with NAV1 STBY
    if (pressed_button==butnav1_cfg9)
    tuning_menu();

    } // end if

    if (nav1_freq != nav1_freq_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(nav1_freq, 70, 0);
    nav1_freq_old = nav1_freq;
    }

    if (nav1_stby != nav1_stby_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(nav1_stby, 70, 55);
    nav1_stby_old = nav1_stby;
    }
    }
    }



    void nav2_cfg()
    {
    int butnav2_cfg1, butnav2_cfg2, butnav2_cfg3, butnav2_cfg4, butnav2_cfg5, butnav2_cfg6, butnav2_cfg9, butX, butY, pressed_button;
    UTFT_Buttons myButtonsn2(&myGLCD, &myTouch);
    myGLCD.clrScr();
    delay(100);
    myButtonsn2.setTextFont(BigFont);
    myButtonsn2.setSymbolFont(Dingbats1_XL);
    butnav2_cfg1 = myButtonsn2.addButton( 120, 120, 50, 50, "+");
    butnav2_cfg2 = myButtonsn2.addButton( 120, 180, 50, 50, "-");
    butnav2_cfg3 = myButtonsn2.addButton( 250, 120, 50, 50, "+");
    butnav2_cfg4 = myButtonsn2.addButton( 250, 180, 50, 50, "-");
    butnav2_cfg5 = myButtonsn2.addButton( 0, 120, 50, 50, "<>");
    butnav2_cfg9 = myButtonsn2.addButton( 0, 180, 50, 50, "BK");

    myGLCD.setFont(BigFont);
    myGLCD.setColor(VGA_WHITE);
    myGLCD.setBackColor(VGA_BLACK);
    myGLCD.print("NAV2 ", 0, 0);
    myGLCD.print("STBY ", 0, 55);

    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(nav2_freq, 70, 0);
    myGLCD.print(nav2_stby, 70, 55);

    myButtonsn2.drawButtons();

    while(1) {
    if (Serial.available()) {
    CodeIn = getChar();
    if (CodeIn == '=') {EQUALS();} // The first identifier is "="
    if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
    if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
    if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
    }
    if (myTouch.dataAvailable() == true) {
    pressed_button = myButtonsn2.checkButtons();

    if (pressed_button==butnav2_cfg1)
    Serial.println("A20"); // send A20 to FSX for NAV2 INC by 1 MHZ
    if (pressed_button==butnav2_cfg2)
    Serial.println("A19"); // send A19 to FSX for NAV2 DEC by 1 MHZ
    if (pressed_button==butnav2_cfg3)
    Serial.println("A22"); // send A22 to FSX for NAV2 INC by 25 kHZ
    if (pressed_button==butnav2_cfg4)
    Serial.println("A21"); // send A21 to FSX for NAV2 DECC by 25 kHZ
    if (pressed_button==butnav2_cfg5)
    Serial.println("A24"); // send A24 to FSX for swapping NAV2 with NAV2 STBY
    if (pressed_button==butnav2_cfg9)
    tuning_menu();

    } // end if

    if (nav2_freq != nav2_freq_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(nav2_freq, 70, 0);
    nav2_freq_old = nav2_freq;
    }

    if (nav2_stby != nav2_stby_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(nav2_stby, 70, 55);
    nav2_stby_old = nav2_stby;
    }
    }
    }



    void xpdr_cfg()
    {
    int butxpdr_cfg0, butxpdr_cfg1, butxpdr_cfg2, butxpdr_cfg3, butxpdr_cfg4, butxpdr_cfg5, butxpdr_cfg6, butxpdr_cfg7, butxpdr_cfg9, butxpdr_cfge, butX, butY, pressed_button;
    UTFT_Buttons myButtonsxpdr(&myGLCD, &myTouch);
    myGLCD.clrScr();
    delay(100);
    myButtonsxpdr.setTextFont(BigFont);
    myButtonsxpdr.setSymbolFont(Dingbats1_XL);
    butxpdr_cfg0 = myButtonsxpdr.addButton( 0, 55, 50, 50, "0");
    butxpdr_cfg1 = myButtonsxpdr.addButton( 80, 55, 50, 50, "1");
    butxpdr_cfg2 = myButtonsxpdr.addButton( 160, 55, 50, 50, "2");
    butxpdr_cfg3 = myButtonsxpdr.addButton( 240, 55, 50, 50, "3");
    butxpdr_cfg4 = myButtonsxpdr.addButton( 0, 120, 50, 50, "4");
    butxpdr_cfg5 = myButtonsxpdr.addButton( 80, 120, 50, 50, "5");
    butxpdr_cfg6 = myButtonsxpdr.addButton( 160, 120, 50, 50, "6");
    butxpdr_cfg7 = myButtonsxpdr.addButton( 240, 120, 50, 50, "7");
    butxpdr_cfg9 = myButtonsxpdr.addButton( 0, 185, 50, 50, "BK");
    butxpdr_cfge = myButtonsxpdr.addButton( 240, 185, 50, 50, "E");

    myGLCD.setFont(BigFont);
    myGLCD.setColor(VGA_WHITE);
    myGLCD.setBackColor(VGA_BLACK);
    myGLCD.print("XPDR ", 0, 0);

    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(xpdr, 70, 0);

    myButtonsxpdr.drawButtons();

    while(1) {
    if (Serial.available()) {
    CodeIn = getChar();
    if (CodeIn == '=') {EQUALS();} // The first identifier is "="
    if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
    if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
    if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
    }
    if (myTouch.dataAvailable() == true) {

    pressed_button = myButtonsxpdr.checkButtons();

    if (pressed_button==butxpdr_cfg0)
    Serial.println("A20"); // send A20 to FSX for NAV2 INC by 1 MHZ
    if (pressed_button==butxpdr_cfg1)
    Serial.println("A20"); // send A20 to FSX for NAV2 INC by 1 MHZ
    if (pressed_button==butxpdr_cfg2)
    Serial.println("A19"); // send A19 to FSX for NAV2 DEC by 1 MHZ
    if (pressed_button==butxpdr_cfg3)
    Serial.println("A22"); // send A22 to FSX for NAV2 INC by 25 kHZ
    if (pressed_button==butxpdr_cfg4)
    Serial.println("A21"); // send A21 to FSX for NAV2 DECC by 25 kHZ
    if (pressed_button==butxpdr_cfg5)
    Serial.println("A24"); // send A24 to FSX for swapping NAV2 with NAV2 STBY
    if (pressed_button==butxpdr_cfg6)
    Serial.println("A20"); // send A20 to FSX for NAV2 INC by 1 MHZ
    if (pressed_button==butxpdr_cfg7)
    Serial.println("A20"); // send A20 to FSX for NAV2 INC by 1 MHZ
    if (pressed_button==butxpdr_cfg9)
    tuning_menu();

    } // end if

    if (xpdr != xpdr_old) {
    myGLCD.setColor(VGA_LIME);
    myGLCD.setFont(SevenSegmentFull);
    myGLCD.print(xpdr, 70, 0);
    xpdr_old = xpdr;
    }
    }
    }

  2. Thanks danko, gil320 thanked for this post
    Likes drmwndr, danko, gil320, BushPilotWannabe liked this post
  3. #2
    New Member gil320's Avatar
    Join Date
    Jun 2008
    Location
    Macau
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch

    thanks to Buddym 7" TFT

    Attached Images Attached Images

  4. #3
    New Member gil320's Avatar
    Join Date
    Jun 2008
    Location
    Macau
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch


  5. #4
    10+ Posting Member
    Join Date
    Jul 2016
    Location
    Stockholm
    Posts
    19
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch

    I bought this and hoped it would be easy to connect =)
    As of now, i dont have idea which of these pins to connect.. There are no drawings.

    Anyone?

    https://cdn-shop.adafruit.com/1200x900/2441-11.jpg

  6. #5
    10+ Posting Member
    Join Date
    Jul 2016
    Location
    Stockholm
    Posts
    19
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch

    Quote Originally Posted by gil320 View Post
    Is your ADF, AP and VS working in that one? =)
    I wanna get my new 3.5" touchscreen to work, but there is no drawings or what pins to connect that i can find.

  7. #6
    500+ This must be a daytime job



    Join Date
    Jan 2009
    Location
    Tampa
    Posts
    527
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch

    The Rasp Pi Model B display module will not interface in the same way as the shield for Arduino.. If you like, I can get 1 of those and write some code to do the same thing....

  8. #7
    10+ Posting Member
    Join Date
    Jul 2016
    Location
    Stockholm
    Posts
    19
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch

    Quote Originally Posted by Buddym View Post
    The Rasp Pi Model B display module will not interface in the same way as the shield for Arduino.. If you like, I can get 1 of those and write some code to do the same thing....
    Ah ok i understand. No sir u dont have to do that. I can just return it and buy another type of display. Would be nice to have like a 7" or something with the whole radio stack on the screen and buttons next to each radio module =)

  9. #8
    500+ This must be a daytime job



    Join Date
    Jan 2009
    Location
    Tampa
    Posts
    527
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch

    I just noticed that the three include statements near the top of the code listing got dropped in the cut-n-paste and I don't know how to tell it not to do that. Look in the file library for the correct lines. You should be including:


    UTFT.h
    UTouch.h
    UTFT_Buttons.h

  10. #9
    10+ Posting Member
    Join Date
    Sep 2014
    Location
    spain
    Posts
    17
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch

    I love this design. You are trying to understand how despite not being programmer. I've included the three libraries mentioned, but I get this error:

    /var/folders/93/zw0j1t6s0db2gns37pldq1lc0000gn/T//ccCCK6VO.ltrans1.ltrans.o: In function `tuning_menu()':

    ccCCK6VO.ltrans1.o.text+0x35c): undefined reference to `SevenSegmentFull'
    ccCCK6VO.ltrans1.o.text+0x35e): undefined reference to `SevenSegmentFull'
    ccCCK6VO.ltrans1.o.text+0x474): undefined reference to `SevenSegmentFull'
    ccCCK6VO.ltrans1.o.text+0x476): undefined reference to `SevenSegmentFull'
    ccCCK6VO.ltrans1.o.text+0x4ca): undefined reference to `SevenSegmentFull'
    /var/folders/93/zw0j1t6s0db2gns37pldq1lc0000gn/T//ccCCK6VO.ltrans1.ltrans.o:ccCCK6VO.ltrans1.o.text+0x4cc): more undefined references to `SevenSegmentFull' follow
    collect2: error: ld returned 1 exit status

    I do not understand where is the fault. Could anyone help me?. Thank you

  11. #10
    500+ This must be a daytime job



    Join Date
    Jan 2009
    Location
    Tampa
    Posts
    527
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: TFT LCD Touch-Screen Radio Sketch

    more than likely the libraries aren't in the correct folder(s)

Page 1 of 2 12 LastLast