Due GUI (Graphical user interface) - [now community project]

You get the CTE stuff from ebay as the links indicated. As far as I know that is the only way to buy from them. The library works with the CTE stuff :slight_smile:

garygid:
Pardon, the Shield says CTE, but the displays do not.

I have a 7" and it has a CTE label on. It does come from them although it might not seem so at a glance.

Ok, I found the ColdTears ebay "store":
http://stores.ebay.com/coldtears-electronics-store

Fortunately, this is the stuff that I just "invested in" (ordered too much).

Thanks all, with the Due on order, this is only my second day on the forum, and yesterday was just reading about all the things that
are being reported as not working for some folks.

I appreciate your help, and I will enjoy using this growing library.

Are you using compile-time "#ifdef" type sections to support
different displays (to keep down the size of the loaded code), or
case statements which compile and load all the options?

Later, Gary

Gary
An important file to look at is the memorysaver.h and the rest is done when you initialize the display. Very simple one line to configure the whole lot. Some folks had to change pin definitions but this is also very easy.

it appears there are problems using this library with the newly released 1.5.3 IDE. there are no issues with 1.5.2. it appears to be a result of changes in the string library.

here are the compile errors i get when compiling the "DueDUI_demo":

DueGUI_demo.ino: In function 'void setup()':
DueGUI_demo:375: error: conversion from 'int' to 'String' is ambiguous
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:61: note: candidates are: String::String(const __FlashStringHelper*)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:59: note:                 String::String(const char*)

if i remove the line DueGUI.db_St(1,"\n\nSERIAL CONNECTED AT 115200\nCompiled at: ");DueGUI.db_St(1,__TIME__);DueGUI.db_St(1," on: ");DueGUI.db_St(1,__DATE__); DueGUI.db_St(1,"\nVersion number: ");DueGUI.db_St(1,(int)VERSION);DueGUI.db_St(1,"");

then i get these errors:

F:\Documents\Arduino\libraries\DUEGUI\DUEGUI.cpp: In member function 'String DUEGUI::displayNumFormat(int, int)':
F:\Documents\Arduino\libraries\DUEGUI\DUEGUI.cpp:4195: error: call of overloaded 'String(int&, int)' is ambiguous
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:73: note: candidates are: String::String(double, int)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:72: note:                 String::String(float, int)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:71: note:                 String::String(long unsigned int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:70: note:                 String::String(long int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:69: note:                 String::String(unsigned int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:68: note:                 String::String(int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:67: note:                 String::String(unsigned char, unsigned char)
F:\Documents\Arduino\libraries\DUEGUI\DUEGUI.cpp: In member function 'String DUEGUI::IntegerToString(long int, int, char)':
F:\Documents\Arduino\libraries\DUEGUI\DUEGUI.cpp:4206: error: call of overloaded 'String(long int&, int)' is ambiguous
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:73: note: candidates are: String::String(double, int)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:72: note:                 String::String(float, int)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:71: note:                 String::String(long unsigned int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:70: note:                 String::String(long int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:69: note:                 String::String(unsigned int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:68: note:                 String::String(int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:67: note:                 String::String(unsigned char, unsigned char)
F:\Documents\Arduino\libraries\DUEGUI\DUEGUI.cpp: In member function 'void DUEGUI::setObjectDate(int, int, int, int, bool, bool)':
F:\Documents\Arduino\libraries\DUEGUI\DUEGUI.cpp:5620: error: call of overloaded 'String(int&, int)' is ambiguous
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:73: note: candidates are: String::String(double, int)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:72: note:                 String::String(float, int)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:71: note:                 String::String(long unsigned int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:70: note:                 String::String(long int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:69: note:                 String::String(unsigned int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:68: note:                 String::String(int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:67: note:                 String::String(unsigned char, unsigned char)
F:\Documents\Arduino\libraries\DUEGUI\DUEGUI.cpp:5622: error: call of overloaded 'String(int&, int)' is ambiguous
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:73: note: candidates are: String::String(double, int)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:72: note:                 String::String(float, int)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:71: note:                 String::String(long unsigned int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:70: note:                 String::String(long int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:69: note:                 String::String(unsigned int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:68: note:                 String::String(int, unsigned char)
F:\arduino-1.5.3\hardware\arduino\sam\cores\arduino/WString.h:67: note:                 String::String(unsigned char, unsigned char)

Sweet!!

Very impressive work.
I'm having problems to run it, when i try to run i get a bunch of errors on the UTFT library.

DueGUI_demo:42: error: 'class UTFT' has no member named 'stopTimer'

And so on.. :~

@wallaceb

there are two different issues here:

ISSUE 1
The meaning pieces of code are:

the example:

[....cut....]
#define VERSION 0.13
[....cut....]
DueGUI.db_St(1,(int)VERSION);
[....cut....]

the db_St function defined as:

  void    db_St(int level, String out);

the example tries to pass an integer to a function that receive a String. As you can see the floating point number 0.13 is first converted to int with a cast and, after that, the compiler try to instantiate the String object using the int value as a pointer to a character array.
In any case, even with 1.5.2, this is not the correct way to instantiate the String.

There are two possible ways to solve the problem, this:

[....cut....]
#define VERSION "0.13"
[....cut....]
DueGUI.db_St(1, VERSION);
[....cut....]

or, if the floating point number is really needed, this:

[....cut....]
#define VERSION 0.13
[....cut....]
DueGUI.db_St(1,String(VERSION));
[....cut....]

IMHO this is not a issue related to the String class and it should be fixed in the example code.

ISSUE 2

The second problem instead is in the new String class, I fixed it here

and will be available for the next IDE release.
If you want to check it out, you can download the updated String class here:

https://raw.github.com/arduino/Arduino/c86eed942dd3d7d0bced4fb26fb28ee57fccff07/hardware/arduino/sam/cores/arduino/WString.h
https://raw.github.com/arduino/Arduino/c86eed942dd3d7d0bced4fb26fb28ee57fccff07/hardware/arduino/sam/cores/arduino/WString.cpp

and replace the files in you arduino installation folder:

hardware/arduino/sam/cores/arduino/WString.cpp
hardware/arduino/sam/cores/arduino/WString.h

Hope this solve all the issues, and thanks for finding the regression in the String class!

I got the Due Shield and the 5" display from CoalTears Electronics in Hong Kong.

I downloaded your zip file from the first post, and unzipped it, and found
two libraries, DUEGUI and ArduinoDueRTCLibrary, and copied those to the
.../adruino-1.5.3/libraries/ folder.

I tried to compile, and the Compile complained that UTFT.h was not found.

I found a UTFT.pdf in your files, and it seemed to suggest that UTFT might be
found at ... http://www.henningkarlsen.com/
I copied the UTFT.rar from there, and now I get these errors:


Arduino: 1.5.3 (Windows Vista), Board: "Arduino Due (Programming Port)"

DueGUI_demo.ino: In function 'void TC3_Handler()':
DueGUI_demo:42: error: 'class UTFT' has no member named 'stopTimer'
DueGUI_demo:55: error: 'class UTFT' has no member named 'anyClockVisible'
DueGUI_demo:58: error: 'class UTFT' has no member named 'setObjectTime'
DueGUI_demo:59: error: 'class UTFT' has no member named 'setObjectDate'
DueGUI_demo:60: error: 'class UTFT' has no member named 'setObjectTime'
DueGUI_demo:61: error: 'class UTFT' has no member named 'redrawObject'
DueGUI_demo:62: error: 'class UTFT' has no member named 'redrawObject'
DueGUI_demo:63: error: 'class UTFT' has no member named 'drawHands'
DueGUI_demo:70: error: 'class UTFT' has no member named 'restartTimer'
DueGUI_demo.ino: In function 'void setup()':
DueGUI_demo:94: error: 'class UTFT' has no member named 'SPI_Flash_init'
DueGUI_demo:96: error: 'class UTFT' has no member named 'UTouch'
DueGUI_demo:97: error: 'class UTFT' has no member named 'InitTouch'
DueGUI_demo:98: error: 'class UTFT' has no member named 'setPrecision'
DueGUI_demo:98: error: 'PREC_MEDIUM' was not declared in this scope
DueGUI_demo:101: error: 'class UTFT' has no member named 'addPanel'
DueGUI_demo:101: error: 'BVS_34' was not declared in this scope
DueGUI_demo:102: error: 'class UTFT' has no member named 'addButton'
DueGUI_demo:102: error: 'BVS_28' was not declared in this scope
DueGUI_demo:103: error: 'class UTFT' has no member named 'addButton'
DueGUI_demo:104: error: 'class UTFT' has no member named 'addButton'
DueGUI_demo:105: error: 'class UTFT' has no member named 'addButton'
DueGUI_demo:106: error: 'class UTFT' has no member named 'addButton'
DueGUI_demo:107: error: 'class UTFT' has no member named 'addDigitalClock_Time'
DueGUI_demo:108: error: 'class UTFT' has no member named 'addDigitalClock_Date'
DueGUI_demo:111: error: 'class UTFT' has no member named 'addAnalogueClock'
DueGUI_demo:113: error: 'class UTFT' has no member named 'redrawAllObjects'
DueGUI_demo:118: error: 'class UTFT' has no member named 'startTimer'
DueGUI_demo.ino: In function 'void loop()':
DueGUI_demo:128: error: 'class UTFT' has no member named 'checkAllButtons'
DueGUI_demo:132: error: 'class UTFT' has no member named 'redrawAllObjects'
DueGUI_demo:145: error: 'class UTFT' has no member named 'makeObjectInvisible'
DueGUI_demo:146: error: 'class UTFT' has no member named 'makeObjectInvisible'
DueGUI_demo:147: error: 'class UTFT' has no member named 'makeObjectInvisible'
DueGUI_demo:148: error: 'class UTFT' has no member named 'makeObjectVisible'
DueGUI_demo:153: error: 'class UTFT' has no member named 'makeObjectInvisible'
DueGUI_demo:154: error: 'class UTFT' has no member named 'makeObjectVisible'
DueGUI_demo:155: error: 'class UTFT' has no member named 'makeObjectVisible'
DueGUI_demo:156: error: 'class UTFT' has no member named 'makeObjectVisible'

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.


So, it would seem that I have the wrong UTFT library?

I think somebody a few posts above had the same problem,
but I did not see an answer.

Please detail, preferably in the first post, exactly what one
needs to do to get your example running in IDE 1.5.3.

THANKS, Gary

Please, does anybody have this DueGUI working with 1.5.3?

If so, what is needed to get it to compile, please?

If not, what is needed with 1.5.2 to get DueGUI to work?


I tried renaming the WString files to WString-Orig and pasting
in a copy of the "fixed" WString, as suggested, but then even
a null Sketch would not compile with 1.5.3 IDE.

Is there a WString bug in 1.5.3 that needs correcting?

Thanks, Gary

OK, I got something to show on the 5" (CTE50) screen, running
the CTE50_800x480 sketch included in the UTFT_CTE library.

However, the DueGUI sketch still will not compile. (Help, Please)


To see these CTE50_800x480 sketch test screens:

I downloaded the UTFT_CTE library (with example Sketches) from:
http://code.google.com/p/cte-lcd-modules-arduino-library/downloads/list

and we ALSO need the UTFT library from:
http://henningkarlsen.com/electronics/library.php

However, to use the UTFT library with the CTE shield-for-Due
(not Mega shield), one needs to:

  1. Uncomment "#define CTE_DUE_SHIELD 1" at the start of the
    HW_ARM_defines.h
    file in the
    \hardware\arm
    folder inside the UTFT library .

  2. If necessary in the example Sketch, change the pin numbers in
    the UTFT myGLCD definition at the beginning of the Sketch to:
    UTFT myGLCD( CTE50, 25, 26, 27, 28 );
    (The definition in the CTE50_800x480 sketch already had these pin numbers.)

garygid:
Please, does anybody have this DueGUI working with 1.5.3?

If so, what is needed to get it to compile, please?

If not, what is needed with 1.5.2 to get DueGUI to work?


I tried renaming the WString files to WString-Orig and pasting
in a copy of the "fixed" WString, as suggested, but then even
a null Sketch would not compile with 1.5.3 IDE.

Is there a WString bug in 1.5.3 that needs correcting?

Thanks, Gary

i just got my 7" screen, and everything is working perfectly for me on 1.5.2. i did not try the suggestion of downloading the new string library. both the demo sketch, and the one i am working on for my personal project are working fine. all you need is the DueGUI library and IDE 1.5.2. nothing else that i am aware of is needed. i say this as i removed the UTFT and the UTFT_CTE library folders from my arduino library directory, and everything still works fine.

Does the 7" screen to use too much power for the Due to be powered by the USB port?

garygid:
Does the 7" screen to use too much power for the Due to be powered by the USB port?

YES it matters! you cannot run the 7" screen off USB, you will overload it, and cause strange behavior.

i accidentally ran my board off USB for a few seconds when i unplugged 7.5 volts without disconnecting USB, and i could hear the wine from the voltage regulators, and the system crashed.

Thanks, very important information to get the 7" screen to work
(that you need to use external power to the Due).

Using IDE 1.5.2, and adding at least the UTFT library with the
define mod for the Due Shield, the DueGUI_demo_02 sketch compiles,
however the DueGUI_demo sketch (the example in the DUEGUI ligrary)
still does not compile.

Without a power supply handy at the moment to use the 7" screen,
and still using 1.5.2 for the IDE, I tried the 5" (same 800x480 resolution),
changing the CTE70 in the pin definition to CTE50.

The DueGUI_demo_02 sketch (for CTE50) compiles and runs, but the
5" screen has horizontal jitters, of about two pixels, and the touch input
does not seem to calibrate well, or properly.

Like this, the 5" screen is unusable with the demo.

Do you get a nice, solid, steady image on the 7" screen?

If the touch input is not calibrated for the screen,
how does one get to the calibration screen?

Can I go set some default touch-calibration values for the 5" screen,
or is the 5" touch input just not compatible with the DueGUI software?

there are two demos, one does not work.

use this one.

part 1:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                              Due GUI Object demonstration sketch
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  (c) 2013 Darren Hill (Cowasaki)
//
#define VERSION 0.13
//
//  This program is not as yet complete.  There are a number of missing features and features not fully implemented.
//  There is also the possibility that anything implemented in this pre-release version may be implemented in a different
//  way in any subsequent version
//
//  Many thanks to those persons that created the original UTFT library - Henning 
//
//



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                              Setup and initialise DUEGUI
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
#include <DUEGUI.h>
DUEGUI DueGUI(CTE70);   // which is: DUEGUI TFT1(CTE70,25,26,27,28);  

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                              Setup for the external RTC library
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
#include <rtc_clock.h>
RTC_clock rtc_clock(RC); 
char* daynames[]={"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
int hh,mm,ss,dow,dd,mon,yyyy;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                 Setup variables for Due GUI
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//

// variables for screens etc
int DueGUI_currentlyDisplayedScreen=0;
#define URNnull 0

// Every screen
int clockDigital,clockDate,background,pnlTitle;

//
// Main menu screen
#define main_menu 1
int btnTB1,btnTB2,btnRemove,btnAdd,progressbar,progressbar2;  // we only need the object number for SOME of the objects....
String mm_dropdown1[10] = {"Blue","Green","Red","Black","White","Yellow"};
#define URNTB1 1
#define URNTB2 2 
#define URNRemove 3 
#define URNAdd 4
#define URNRefresh 5
#define URNFanScreen 6
#define URNInputScreen 7     
#define URNClockScreen 8
#define URNCalibrate 9
#define URNProgressbar 10
#define URNProgressbar2 11
#define URNghostbutton 12
#define URNimagebutton1 13
#define URNimagebutton2 14
#define URNstringcycle 15

//
// Fan screen
#define fan_screen 2
int btnFBonoff0,btnFBspeed0,btnFBonoff1,btnFBspeed1,btnFBonoff2,btnFBspeed2,btnFBonoff3,btnFBspeed3;
#define URNFBmainmenu 209 
int valFBspeed[] = {4000,3000,500,0};
boolean valFBonoff[] = {true,false,false,true};

//
// input screen
#define input_screen 3
int inpInput1,inpInput2,inpInput3;
String valInput1="Test 1",valInput2="Test 2",valInput3="Test 2";
#define URNINPinput1 301 
#define URNINPinput2 302 
#define URNINPinput3 303 
#define URNINPmainmenu 309 

//
// clock screen
#define clock_screen 4
int clockAnalogue,clockAnalogue2,clockAnalogue3;
#define URNCLKmainmenu 409 


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                 Due GUI Interupt routine and variables
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// fast ticks for Due GUI interupt
volatile int l;
volatile int btnFound;
volatile unsigned long int GUI_InterruptTime;
unsigned long int GUI_ButtonLastPressedTime;
//
//  DueGUI Interupt handler routine
//
void DueGUI_tickHandler(){
  //
  // We don't want timer called whilst it's being handled.
  //
  GUI_InterruptTime=millis();
  DueGUI.stopTimer(DueGUI_timer);
  //
  // routine is called several times per second ie "ticksPerSecond".
  // l is incremented each time and by checking this against "ticksPerSecond"
  // we can make sure that once a second events are only called once per second.
  //
  l+=1;
  //
  // This is the "once per second" event routine.
  //
  if (l==ticksPerSecond){
    // second passed
    l=0;
    if (DueGUI.anyClockVisible) {
      rtc_clock.get_time(&hh,&mm,&ss);
      rtc_clock.get_date(&dow,&yyyy,&mon,&dd);
      //
      // Insert below the set and redraw clock functions:
      //
      DueGUI.setObjectTime(clockDigital,hh,mm,ss);
      DueGUI.redrawObject(clockDigital);
      DueGUI.setObjectDate(clockDate,dd,mon,yyyy,true,true);
      DueGUI.redrawObject(clockDate);
      
      if (DueGUI_currentlyDisplayedScreen==main_menu){ 
        DueGUI.updateProgressBar(progressbar,ss);
        DueGUI.updateProgressBar(progressbar2,ss);
      }
      
      //
      //  The analogue clock is only shown on the clock screen
      
      if (DueGUI_currentlyDisplayedScreen==clock_screen){  
        DueGUI.setObjectTime(clockAnalogue,hh,mm,ss);
        DueGUI.setObjectTime(clockAnalogue2,((hh+5)%12),mm,ss);
        DueGUI.setObjectTime(clockAnalogue3,((hh+5)%12),((mm+30)%60),ss);
        DueGUI.drawHands(clockAnalogue);
        DueGUI.drawHands(clockAnalogue2);
        DueGUI.drawHands(clockAnalogue3);
      }
    }
  }
  
  
  if ((DueGUI.dataAvailable()==true) || (DueGUI.anyButtonPressed==true)){
    if ((GUI_ButtonLastPressedTime+200)<GUI_InterruptTime){
      GUI_ButtonLastPressedTime=GUI_InterruptTime;
      btnFound=DueGUI.checkAllButtons();
      if (btnFound!=-1){
        DueGUI_OnButtonPress(btnFound);
      }
    }
  }
  
  // Ok interupt handler is finished. 
  //
  TC_GetStatus(TC1, 0);
  DueGUI.restartTimer(DueGUI_timer);
}



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                   DueGUI On button press routine
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
void DueGUI_OnButtonPress(int btnFound){
  //
  //  Find the URN of the button that was found.
  //
  int URN=DueGUI.GUIobject_UniqueReference[btnFound];
  if (URN>GUIURNnull){
    DueGUI.HandleShowButtons(URN);
  } else {
  
    //  Main Menu
    //
    if (URN==URNRefresh){DueGUI.redrawAllObjects();}
    if (URN==URNTB1){}
    if (URN==URNTB2){}
    if (URN==URNRemove){
      DueGUI.makeObjectInvisible(btnRemove,true); 
      DueGUI.makeObjectInvisible(btnTB1,true);
      DueGUI.makeObjectInvisible(btnTB2,true); 
      DueGUI.makeObjectVisible(btnAdd,true); 
    }
    if (URN==URNAdd){
      DueGUI.makeObjectInvisible(btnAdd,true); 
      DueGUI.makeObjectVisible(btnTB1,true);
      DueGUI.makeObjectVisible(btnTB2,true); 
      DueGUI.makeObjectVisible(btnRemove,true); 
    }
    
    if (URN==URNFanScreen){DueGUI_createScreen(fan_screen);}
    if (URN==URNghostbutton){DueGUI_createScreen(fan_screen);}
    if (URN==URNimagebutton2){DueGUI_createScreen(fan_screen);}
    if (URN==URNInputScreen){DueGUI_createScreen(input_screen);}
    if (URN==URNClockScreen){DueGUI_createScreen(clock_screen);}
    if (URN==URNCalibrate){DueGUI.showCalibrate();}
  
    // Fan screen buttons
    //
    if (URN==URNFBmainmenu){
      // Grab the data BEFORE you switch screens.
      //
      // Note the objects were created in order so we know that btnFBonoff1 is 1 more than btnFBonoff0 etc.  We can use this
      // to calculate object values in order to place in loops etc.
      //
      // store the values of the cycBoxes in variables ready to use again later
      for (int i = 0; i < 4; i++){
        valFBspeed[i]=DueGUI.returnIntValue(btnFBspeed0+i);
        valFBonoff[i]=DueGUI.returnBoolValue(btnFBonoff0+i);
      }
      printvariables();
      DueGUI_createScreen(main_menu);
    }

part 2:

   // Input screen buttons
    //
    if (URN==URNINPmainmenu){
      //
      // Store the values of the input boxes for next time.
      valInput1=DueGUI.returnStringValue(inpInput1);
      valInput2=DueGUI.returnStringValue(inpInput2);
      DueGUI_createScreen(main_menu);
    }
  
    // Clock screen buttons
    //
    if (URN==URNCLKmainmenu){
      DueGUI_createScreen(main_menu);
    }
  }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                   DueGUI display a new screen
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
void DueGUI_createScreen(int screen){
  // First stop interupts whilst we build screen
  DueGUI.stopTimer(DueGUI_timer);

  // Set global variable to record which screen is in view
  DueGUI_currentlyDisplayedScreen=screen; 

  // Clear all the data and the screen
  DueGUI.clearAllObjects();
  DueGUI.clrScr();
  
  // Setup anything that is on EVERY screen
  // NOTE: pnlTitle's text is left blank as it is filled in by each screens functions.
  pnlTitle=     DueGUI.addPanel(0,0,799,50,clrBlue,clrWhite,clrWhite,2,"",280,8,BVS_34,optVisible,URNnull); 
  clockDigital= DueGUI.addDigitalClock_Time(681,11,clrBlue,clrWhite,0,BVS_34,optVisible,URNnull);
  clockDate=    DueGUI.addDigitalClock_Date(15 ,11,clrBlue,clrWhite,0,BVS_34,optVisible,URNnull);
  
  if (DueGUI_currentlyDisplayedScreen==main_menu){
    DueGUI.db_St(2, "Setup: main_menu");
    // As a demonstration here we are grabbing the object number for every item and setting the URN value for every button.  As can be seen below
    //  you don't actually need to do this for a lot of buttons because the library handles the updating etc automatically.  Once we get to using the
    //  settings they will be read from the objects using the object number variable.
    //
    // For the buttons we need the object number for TB1, TB2, remove and add because we will be making them visible/invisible whilst
    // running.  We could use the function findObjectByURL(URNRemove); for example but this is down to choice.
                 //                   (word x,word y,word xs,word ys,word maxvalue,word redvalue,word initialvalue,word options,long colour,long borcolour,long backcolour,long redcolour,long borwidth,bool visible,int URN) 
    progressbar= DueGUI.addProgressBar(375   ,100   ,400    ,30     ,60           ,50           ,ss               ,1           ,clrBlue    ,clrWhite      ,clrBlack       ,clrRed        ,2            ,optVisible  ,URNProgressbar); 
    progressbar2=DueGUI.addProgressBar(20    ,100   ,40     ,350    ,60           ,30           ,ss               ,0           ,clrGreen   ,clrWhite      ,clrBlack       ,clrYellow     ,2            ,optVisible  ,URNProgressbar2); 
    DueGUI.addButton(100,425,200,50,clrBlue ,clrWhite ,clrWhite,clrRed,clrWhite,2,"Refresh",posCentre,posCentre,BVS_28,optVisible ,URNRefresh); 
    btnAdd=DueGUI.addButton(100 ,250,200,50,clrCyan ,clrWhite ,clrBlack,clrRed,clrWhite,2,"Bring back 1&2",posCentre,posCentre,BVS_28,optInvisible,URNAdd    ); 
    btnRemove=DueGUI.addButton(100 ,350,200,50,clrGreen,clrWhite ,clrBlack,clrRed,clrWhite,2,"Remove  1&2",posCentre,posCentre,BVS_28,optVisible ,URNRemove ); 
    DueGUI.addButton(350,350,199,50,clrBlue ,clrWhite ,clrWhite,clrRed,clrWhite,2,"Fan Screen",posCentre,posCentre,BVS_28,optVisible,URNFanScreen); 
    DueGUI.addButton(600,350,199,50,clrBlue ,clrWhite ,clrWhite,clrRed,clrWhite,2,"Clock Screen",posCentre,posCentre,BVS_28,optVisible,URNClockScreen); 
    DueGUI.addButton(350,425,199,50,clrBlue ,clrWhite ,clrWhite,clrRed,clrWhite,2,"Input Screen",posCentre,posCentre,BVS_28,optVisible,URNInputScreen); 
    DueGUI.addButton(600,425,199,50,clrBlue ,clrWhite ,clrWhite,clrRed,clrWhite,2,"Calibrate",posCentre,posCentre,BVS_28,optVisible,URNCalibrate); 
    DueGUI.addGhostButton(0,0,799,50,0,optVisible,URNghostbutton);
    DueGUI.addImageButton(400,200,55,56,57,1,true,0,optVisible,URNimagebutton1);
    DueGUI.addImageButton(500,200,58,59, 0,1,true,0,optVisible,URNimagebutton2); 
    btnTB1=DueGUI.addButton(100 ,100,200,50,clrBlue ,clrWhite ,clrWhite,clrRed,clrWhite,2,"Nothing 2",posCentre,posCentre,BVS_28,optVisible,URNTB1    ); 
    btnTB2=DueGUI.addButton(100 ,175,200,50,clrBlue ,clrWhite ,clrWhite,clrRed,clrWhite,2,"Nothing",posCentre,posCentre,BVS_28,optVisible,URNTB2    ); 
    // For the clocks we DO need to know the object number as this will be required by the time/date setting up functions
    // Change the text in the header panel
    DueGUI.addCycleStringButton(350,275,299,50,clrBlue ,clrWhite ,clrWhite,clrRed,clrWhite,2,"Cycle Text",15,posCentre,BVS_28,1,mm_dropdown1,100,1,optVisible,URNstringcycle);
    DueGUI.GUIobject_top[pnlTitle]="Main  Menu";
  }
  
  if (DueGUI_currentlyDisplayedScreen==fan_screen){
    DueGUI.db_St(2,"Setup: fan_screen");
    // NOTE the return value is not being stored for the main menu button...  Unless you need to refer to the object once created you don't actually
    //  have to store it! also the URN isn't needed either for the first 8 buttons because they are handled by the library and no user intervention 
    //  is required so they can be set to the special URNnull value. If we were actually going to use these values now we can get them via the object
    //  number.  This would normally be done as the screen is changed so in this case when the main menu button is pressed.  ie you would get them like
    //  this   fan1onoff=DueGUI.returnBoolValue(btnFBonoff1);
    //  or     fan1speed=DueGUI.returnIntValue(btnFBspeed1);
    //  Note for all these button the value are given as an initial value and then retrieved alter so that as we come and go to this screen the values
    //  are persistent.
    //
    printvariables();
    
                     //addCycleButton(word x,word y,word xs,word ys,long colour,long borcolour,long textcolour,long presscolour,long presstextcolour,byte borwidth,String top,word xo,word yo,int font,int initialstate,int cyclemin,int cyclemax,int cyclestep,int options,bool visible,int URN){
    btnFBspeed0=DueGUI.addCycleButton(300,100,249,50,clrBlue,clrWhite ,clrWhite,clrRed,clrWhite,2,"Speed",20,posCentre,BVS_28,valFBspeed[0],0,9000,500,75,1,optVisible,URNnull); 
    btnFBspeed1=DueGUI.addCycleButton(300,175,249,50,clrBlue,clrWhite ,clrWhite,clrRed,clrWhite,2,"Speed",20,posCentre,BVS_28,valFBspeed[1],0,9000,500,75,1,optVisible,URNnull); 
    btnFBspeed2=DueGUI.addCycleButton(300,250,249,50,clrBlue,clrWhite ,clrWhite,clrRed,clrWhite,2,"Speed",20,posCentre,BVS_28,valFBspeed[2],0,9000,500,75,0,optVisible,URNnull); 
    btnFBspeed3=DueGUI.addCycleButton(300,325,249,100,clrBlue,clrWhite ,clrWhite,clrRed,clrWhite,2,"Speed",20,posCentre,BVS_28,valFBspeed[3],0,9000,500,75,2,optVisible,URNnull); 

    btnFBonoff0=DueGUI.addCheckBox(50,100,199,50,clrBlue,clrWhite ,clrWhite,clrRed,clrWhite,2,"Fan on",20,posCentre,BVS_28,valFBonoff[0],cycCHECKBOX,optVisible,URNnull); 
    btnFBonoff1=DueGUI.addCheckBox(50,175,199,50,clrBlue,clrWhite ,clrWhite,clrRed,clrWhite,2,"Fan on",20,posCentre,BVS_28,valFBonoff[1],cycCHECKBOX,optVisible,URNnull); 
    btnFBonoff2=DueGUI.addCheckBox(50,250,199,50,clrBlue,clrWhite ,clrWhite,clrRed,clrWhite,2,"Fan on",20,posCentre,BVS_28,valFBonoff[2],cycCHECKBOX,optVisible,URNnull); 
    btnFBonoff3=DueGUI.addCheckBox(50,325,199,50,clrBlue,clrWhite ,clrWhite,clrRed,clrWhite,2,"Fan on",20,posCentre,BVS_28,valFBonoff[3],cycCHECKBOX,optVisible,URNnull); 
    DueGUI.addButton(600,400,150,50,clrBlue,clrWhite,clrWhite,clrRed,clrWhite,2,"Main Menu",20,posCentre,BVS_28,optVisible,URNFBmainmenu); 
    // Change the text in the header panel
    DueGUI.GUIobject_top[pnlTitle]="Fan  Screen";
  }

part 3:

  if (DueGUI_currentlyDisplayedScreen==input_screen){  
    DueGUI.db_St(2,"Setup: input_screen");
    DueGUI.addButton(600,400,150,50,clrBlue,clrWhite,clrWhite,clrRed,clrWhite,2,"Main Menu",20,posCentre,BVS_28,optVisible,URNINPmainmenu); 
//      int          addTextInput(word x,word y,word xs,word ys,long colour,long borcolour,long textcolour,long inputboxcolour,long inputtextcolour,byte borwidth,String top,int popup_y,word xo  ,word yo  ,String initialstate,int inputlength,int options,int font,bool visible,int URN);
    inpInput1=DueGUI.addTextInput(100   ,150   ,400    ,80     ,clrBlue    ,clrWhite      ,clrWhite       ,clrBlack           ,clrWhite            ,2            ,"Enter"   ,-0         ,20       ,posCentre,valInput1          ,10             ,0          ,BVS_28  ,optVisible  ,URNINPinput1);
    inpInput2=DueGUI.addTextInput(100   ,350   ,400    ,80     ,clrBlue    ,clrWhite      ,clrWhite       ,clrBlack           ,clrWhite            ,2            ,"Enter 2" ,-200       ,20       ,posCentre,valInput2          ,15             ,0          ,BVS_28  ,optVisible  ,URNINPinput1);
    inpInput3=DueGUI.addTextInput(100   ,75    ,400    ,80     ,clrBlue    ,clrWhite      ,clrWhite       ,clrBlack           ,clrWhite            ,2            ,""        ,0          ,20       ,posCentre,valInput3          ,30             ,1          ,BVS_28  ,optVisible  ,URNINPinput1);
    // Change the text in the header panel
    DueGUI.GUIobject_top[pnlTitle]="Input  Screen";
  }
  
  if (DueGUI_currentlyDisplayedScreen==clock_screen){  
    DueGUI.db_St(2,"Setup: clock_screen");
    DueGUI.addButton(600,400,150,50,clrBlue,clrWhite,clrWhite,clrRed,clrWhite,2,"Main Menu",20,posCentre,BVS_28,optVisible,URNCLKmainmenu); 
    clockAnalogue=DueGUI.addAnalogueClock(65,200,270,15,clrBlack,clrYellow,clrRed,80,clrGreen,90,clrWhite,100,15,24,optVisible,URNnull);
    clockAnalogue2=DueGUI.addAnalogueClock(465,200,270,15,clrBlack,clrYellow,clrRed,80,clrGreen,90,clrWhite,100,20,2,optVisible,URNnull);
    clockAnalogue3=DueGUI.addAnalogueClock(320,360,150,15,clrBlack,clrYellow,clrBlue,80,clrGreen,90,clrWhite,100,20,2,optVisible,URNnull);
    // Change the text in the header panel
    DueGUI.GUIobject_top[pnlTitle]="Clock  Screen";
  }
  
  // ok draw all the new objects that are supposed to be visible
  DueGUI.redrawAllObjects();
  // we can restart the interupts now
  DueGUI.restartTimer(DueGUI_timer);
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                   Functions used for the demo only
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
void  printvariables(){
  Serial.println();
    for (int i = 0; i < 4; i++){
      Serial.print("Fan ("); Serial.print(i); Serial.print(") is set as - ");Serial.print(DueGUI.truefalse(valFBonoff[i]));
      Serial.print(" at speed = "); Serial.println(valFBspeed[i]);
    }
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                   DueGUI demo setup() function
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
void setup(){ 
  
  // Turn debug mode on at level 5 (normal)
  DueGUI.debug(5);
  
  // Initialise serial on the programming port (this section is for debugging)....
  Serial.begin(115200);
  DueGUI.db_St(1,"\n\nSERIAL CONNECTED AT 115200\nCompiled at: ");DueGUI.db_St(1,__TIME__);DueGUI.db_St(1," on: ");DueGUI.db_St(1,__DATE__); DueGUI.db_St(1,"\nVersion number: ");DueGUI.db_St(1,(int)VERSION);DueGUI.db_St(1,"");

  //
  // Initialise for RTC
  rtc_clock.init(); rtc_clock.set_time(__TIME__); rtc_clock.set_date(__DATE__);
  
  //
  // Initialise DueGUI
  DueGUI.InitGUI(6,5,32,3,2,52,2,51);//should likley be DueGUI.InitGUI(6,5,32,3,2,52,2,53);
  
  // Display "main_menu" screen
  DueGUI_createScreen(main_menu);
  
 }


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                   DueGUI demo loop() function
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
void loop(){
  // Handle loop stuff from library:
  DueGUI.HandleShowLoop(); 
  // Do your things here:
  
  
 
}

I found a 9v Arduino power supply (1 amp) but I hesitate to plug it
into the Due at the same time as the Programming USB is connected
to the PC, for fear of feeding back power into the PC's USB port.

So, with IDE version 1.5.2, I compile and load the DueGUI_demo_02
sketch into the naked Due, powered only by the USB connection.

Then, unplug the USB cable, plug in the CTE70 (7") screen, and
then plug in the 9v power. The demo works, with no jitter,
and with proper handling of the touch input. But, awkward.

Suggestions for handling the External Power better?

garygid:
I found a 9v Arduino power supply (1 amp) but I hesitate to plug it
into the Due at the same time as the Programming USB is connected
to the PC, for fear of feeding back power into the PC's USB port.

So, with IDE version 1.5.2, I compile and load the DueGUI_demo_02
sketch into the naked Due, powered only by the USB connection.

Then, unplug the USB cable, plug in the CTE70 (7") screen, and
then plug in the 9v power. The demo works, with no jitter,
and with proper handling of the touch input. But, awkward.

Suggestions for handling the External Power better?

you do not need to worry about back feeding, the arduino will automatically select the voltage that works, in your case the 9 volts. the arduino can handle up to 12 volts, so 9 is fine. when i am actively working on code, i always have the DC supply connected at the same time as the USB.

cowasaki

can i ask how the dash is going. I am very interested in your project as I'm sure many others are.

Would be great to see the inclusion of some guages (rev counter type) within the library

Rob