Go Down

Topic: MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields (Read 44807 times) previous topic - next topic

david_prentice

What drawBitmap() function?

UTFT has two drawBitmap() methods
Code: [Select]

 void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale=1);
 void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int deg, int rox, int roy);


UTFTGLUE has only got one drawBitmap() method:
Code: [Select]

 void drawBitmap(int x, int y, int sx, int sy, uint16_t *data, int scale=1);


It would probably be wiser to declare it as:
Code: [Select]

 void drawBitmap(int x, int y, int sx, int sy, const uint16_t *data, int scale=1);

because it is using PROGMEM.

On my v1.6.9 IDE,  it works quite happily with or without the const.
I have never bothered to implement drawing a rotated bitmap.  

What problem do you have?

David.

ddwasil

Hi David :
       I have a problem I can`t read pictures from sd card .I can`t compile  .becouse show me  "bmpDraw was not declared in this scope"


I put the next libreries


Code: [Select]
#include <Adafruit_GFX.h>    // Core graphics library
#include <MCUFRIEND_kbv.h>
#include <TouchScreen.h>
#include <SPI.h>
#include <SD.h>
MCUFRIEND_kbv tft;


#define YP A1 
#define XM A2
#define YM 7   
#define XP 6   
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);


#define MINPRESSURE 10      //sensibilidad al hacer clic en el toque
#define MAXPRESSURE 1000
#define LCDROTATION 0



const int chipSlect=10;


void setup(void)
{
                        Serial.begin(9600);
                        tft.reset();
                        tft.begin(0x9488);
                        tft.fillScreen(BLACK);
                        tft.setRotation(1);

                           
                      Serial.begin (9600);
                     while (!Serial) {  }
                               
                  Serial.println("leyendo sd");
           
                      pinMode (chipSlect,OUTPUT);//configuro salida de seleccion d esclavo
   
     if (!SD.begin(chipSlect))//si no inicio la SD  muestro error
        {
           Serial.println("fallo lectura de  sd");
           delay(2000);
           return;
        }
        Serial.println(" SD iniciada ");
        delay(2000);
       
                       
}

void loop()
 {
           
               TSPoint p = ts.getPoint();
               pinMode(XP, OUTPUT);
               pinMode(XM, OUTPUT);
               pinMode(YP, OUTPUT);
               pinMode(YM, OUTPUT);
                          tft.setRotation(0);
 
 bmpDraw ("woof.bmp", 0, 0);        //THE PROBLEM
                           delay(1000);
 
                   tft.setRotation(3);
 bmpDraw ("test.bmp",0,0);
               delay(1000);
                 
 }


 

david_prentice

There are examples of bmpDraw() functions in the Beta.
And most Adafruit libraries have code.

It is always wise to start with an example.   Then modify it to suit your requirements.
This will mean you are never more than one step away from a working project.

You will probably find that the bmpDraw() function is in a separate tab.

Incidentally,  if you press the ctrl-T key,   your sketch will get indented nicely.   It makes everything easier to read.

David.

andy_k

ok thanks I've managed to compile it but I always get the exception that the sketch is too big. I'm trying to load a converted 50x50 icon. Do I have to put it on the SD slot?

david_prentice

A full colour 50x50 icon will need 50x50x2 = 5000 bytes of flash.

Life would be much simpler if you quoted some real numbers.   e.g. turn on verbose compilation in Preferences.   Copy-paste only the Error message.    Please do not post the complete output.

Look at the graphictest_kbv example.   Tux the penguin is a 40x40 icon.
Write a simple sketch that clears the screen and displays a single Tux.

Then add your icon and display it too.

David.

Edit. corrected Tux's vital statistics.

andy_k

In graphictest_kbv you are using pushcolor not drawBitmap
I don't understand the pushcolor function
you say the penguin has 32x32
the penguin shows fine on my 480x320 screen with this
Code: [Select]
tft.setAddrWindow(20, 20, 59, 59);
tft.pushColors(penguin, 1600, 1)


So x(y)-start is 20 and x(y)-end is 59. That's 39, why not 32? if I try with 32 the image is not good. what is the 1600 in pushcolors for?
how do I have to adjust these values for my 50x50 icon?

david_prentice

Sorry,  I was typing from a Tablet.   I could not remember what size the penguin was.   It looks like it must be 40x40.

I have followed the Adafruit conventions:

The setAddrWindow(x1, y1, x2, y2) takes the coordinate limits.   e.g. from x1=20 to x2=59 which is 40 pixels inclusive.

Most other methods use (x, y, w, h) which is more intuitive.   

Obviously your 50x50 icon would need:
Code: [Select]

    tft.setAddrWindow(x, y, x - 1 + 50, y - 1 + 50);
    tft.pushColors(icon_50x50, 50 * 50, 1)


ddwasil

I david
            You have an example for read pictures from sd card because there are a lot of post.
And I don't understand  a lot of point .I have tft IL9488 that is working ok ,I have 8 screen and  I can change  between screen .I need  put a picture
thank you

jcmojj

Hi David,

First of all I want to thank you for all effort you have done helping everybody! I also have a problem and I need some help. I can't read anything from the touchscreen that is 2.4" tft red shield. When I use the TouchScreen_Calibr_kbv the serial monitor returns only "TouchScreen.h Calibration". When I touch the screen nothing happens. When I run the LCD_ID_readreg returns at the serial monitor:
Quote
Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00   ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00   Manufacturer ID
reg(0x0009) 00 00 00 00 00   Status Register
reg(0x000A) 00 08   Get Powsr Mode
reg(0x000C) 00 66   Get Pixel Format
reg(0x0061) 00 00   RDID1 HX8347-G
reg(0x0062) 00 00   RDID2 HX8347-G
reg(0x0063) 00 00   RDID3 HX8347-G
reg(0x0064) 00 00   RDID1 HX8347-A
reg(0x0065) 00 00   RDID2 HX8347-A
reg(0x0066) 00 00   RDID3 HX8347-A
reg(0x0067) 00 00   RDID Himax HX8347-A
reg(0x0070) 00 00   Panel Himax HX8347-A
reg(0x00A1) 00 FF FF 00 00   RD_DDB SSD1963
reg(0x00B0) 00 00   RGB Interface Signal Control
reg(0x00B4) 00 00   Inversion Control
reg(0x00B6) 00 00 00 00 00   Display Control
reg(0x00B7) 00 00   Entry Mode Set
reg(0x00BF) 00 01 22 15 20 02   ILI9481, HX8357-B
reg(0x00C0) 00 00 4F 00 00 02 00 01 00   Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00   GAMMA
reg(0x00CC) 00 00   Panel Control
reg(0x00D0) 00 07 C3   Power Control
reg(0x00D2) 00 63 24 00 00   NVM Read
reg(0x00D3) 00 00 00 00   ILI9341, ILI9488
reg(0x00DA) 00 00   RDID1
reg(0x00DB) 00 00   RDID2
reg(0x00DC) 00 00   RDID3
reg(0x00E0) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   GAMMA-N
reg(0x00EF) 00 00 00 00 00 00   ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00   Adjust Control 2
reg(0x00F6) 00 00 00 00   Interface Control
At the aspect_kbv file the serial monitor returned ID = 0x1520.
The graphic_test_kbv said the same thing.
I installed the Fat library from greiman github and when I run it I received the message:
Show BMP files on TFT with ID:0x1520
cannot start SD
and the screen of the lcd is blue. I had two files at the SD with 320x240 called image1 and image2
With the touch_shield_kbv the screen changed values as I touch and at the SM I had:
Quote
Found unknown LCD driver
ID=0x1520
Screen is 240x320
Calibration is:
LEFT = 920 RT  = 150
TOP  = 940 BOT = 120
Wiring is: PORTRAIT
YP=55 XM=56
YM=7 XP=6
With the TouchScreen_Calibr_kbv the Serial Monitor had TouchScreen.h Calibration and the display shows "#define NUMSAMPLES 3" in Library and some instructions. It doesn't recognize any touch. I didn't understand what you mean by what is written inside "".
With the UTouch_Calibr_kbv I received this error message:

Quote
Arduino: 1.6.7 (Windows 10), Placa:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:27:43: warning: large integer implicitly truncated to unsigned type [-Woverflow]

 UTFTGLUE myGLCD(0x9341, A2, A1, A3, A4, A0);

                                           ^

UTouch_Calibr_kbv:79: error: declaration of 'FreeSmallFont' as array of references

 extern uint8_t SmallFont[];

                          ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino: In function 'void done()':

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:286:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("LEFT ", (calx >> 14) & 0x3FFF, 0, 186);

                                                    ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:287:48: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("RT   ", (calx) & 0x3FFF, 100, 186);

                                                ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:289:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("TOP  ", (caly >> 14) & 0x3FFF, 0, 198);

                                                    ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:290:48: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("BOT  ", (caly) & 0x3FFF, 100, 198);

                                                ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:292:50: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("WID ", (cals >> 12) & 0xFFF, 0, 210);

                                                  ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:293:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("HT  ", (cals) & 0xFFF, 100, 210);

                                              ^

exit status 1
declaration of 'FreeSmallFont' as array of references
So the main problem is set the touchscreen and the sd card to work.
Thanks a lot and any extra info, just ask!



david_prentice

Hi David,

First of all I want to thank you for all effort you have done helping everybody! I also have a problem and I need some help. I can't read anything from the touchscreen that is 2.4" tft red shield. When I use the TouchScreen_Calibr_kbv the serial monitor returns only "TouchScreen.h Calibration". When I touch the screen nothing happens. When I run the LCD_ID_readreg returns at the serial monitor:

Code: [Select]
Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x000A) 00 08 Get Powsr Mode
reg(0x000C) 00 66 Get Pixel Format
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 00 Panel Himax HX8347-A
reg(0x00A1) 00 FF FF 00 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 00 Inversion Control
reg(0x00B6) 00 00 00 00 00 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 01 22 15 20 02 ILI9481, HX8357-B
reg(0x00C0) 00 00 4F 00 00 02 00 01 00 Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 00 Panel Control
reg(0x00D0) 00 07 C3 Power Control
reg(0x00D2) 00 63 24 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

At the aspect_kbv file the serial monitor returned ID = 0x1520.
The graphic_test_kbv said the same thing.
I installed the Fat library from greiman github and when I run it I received the message:
Show BMP files on TFT with ID:0x1520
cannot start SD
and the screen of the lcd is blue. I had two files at the SD with 320x240 called image1 and image2
With the touch_shield_kbv the screen changed values as I touch and at the SM I had:

Code: [Select]
Found unknown LCD driver
ID=0x1520
Screen is 240x320
Calibration is:
LEFT = 920 RT  = 150
TOP  = 940 BOT = 120
Wiring is: PORTRAIT
YP=55 XM=56
YM=7 XP=6


With the TouchScreen_Calibr_kbv the Serial Monitor had TouchScreen.h Calibration and the display shows "#define NUMSAMPLES 3" in Library and some instructions. It doesn't recognize any touch. I didn't understand what you mean by what is written inside "".
With the UTouch_Calibr_kbv I received this error message:

Code: [Select]
"
Arduino: 1.6.7 (Windows 10), Placa:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:27:43: warning: large integer implicitly truncated to unsigned type [-Woverflow]

 UTFTGLUE myGLCD(0x9341, A2, A1, A3, A4, A0);

                                           ^

UTouch_Calibr_kbv:79: error: declaration of 'FreeSmallFont' as array of references

 extern uint8_t SmallFont[];

                          ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino: In function 'void done()':

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:286:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("LEFT ", (calx >> 14) & 0x3FFF, 0, 186);

                                                    ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:287:48: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("RT   ", (calx) & 0x3FFF, 100, 186);

                                                ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:289:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("TOP  ", (caly >> 14) & 0x3FFF, 0, 198);

                                                    ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:290:48: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("BOT  ", (caly) & 0x3FFF, 100, 198);

                                                ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:292:50: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("WID ", (cals >> 12) & 0xFFF, 0, 210);

                                                  ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\UTouch_Calibr_kbv\UTouch_Calibr_kbv.ino:293:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("HT  ", (cals) & 0xFFF, 100, 210);

                                              ^

exit status 1
declaration of 'FreeSmallFont' as array of references
"

So the main problem is set the touchscreen and the sd card to work.
Thanks a lot and any extra info, just ask!
First off.   Thanks for the feedback.   Secondly,  please note that I have edited your quoted post to use CODE tags.   This makes a message far more readable.    I suggest that you edit your original post for the benefit of other readers.   And I can then remove my quoted copy.

1.  you have a Renesas R61520 controller with ID = 0x1520.   Note that this controller can NOT do Vertical Scroll.

2.  the Beta on GitHub has got an example called showBMP_kbv_as7.ino
    Arduino SD.h library or third party SdFat.h library are pretty flaky.
    They should both work fine with a Uno which has its hardware SPI on 10, 11, 12, 13
    When you want to bit-bang SPI on a Mega2560 on 10, 11, 12, 13 you need to edit special values.
    If you do this correctly,   a Mega or Due will work just fine

3.  The showBMP example is looking for genuine BMP file called /bitmaps/tiger*.bmp
4.  If your BMP files do not have pictures of tigers,  you probably want to look for *.bmp in the root directory.  e.g.
Code: [Select]

...
char namebuf[32] = "/";
...
        if (strstr(nm, ".bmp") != NULL && strstr(nm, "") != NULL) {
        ...


5.   I ran the diagnose_Touchpins.ino sketch:
Code: [Select]

Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A1, D7) = 31
Testing : (A2, D6) = 26
Diagnosing as:-
YP,YM:  (A1, D7) = 31
XM,XP:  (A2, D6) = 26


6.   Compilation errors.   The code on GitHub is Beta.   I will edit the UTFTGLUE.h file to ignore UTFT fonts as a default.   e.g. by undef the GFX support for FreeFonts
Code: [Select]

#include <Adafruit_GFX.h>

#undef _GFXFONT_H_     //comment this line to enable FreeFonts
#if defined(_GFXFONT_H_)
#include <FreeDefaultFonts.h>
#define SmallFont &FreeSmallFont
#define BigFont   &FreeBigFont
#define SevenSegNumFont &FreeSevenSegNumFont
#else
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
#endif


7.   The warning: deprecated conversion from string constant to 'char*' messages can be "cured" by expecting those strings as "const" e.g.
Code: [Select]

void showNumI(const char *msg, uint32_t val, int x, int y)


8.   I have no idea why you have chosen Utouch_Calibr_kbv instead of the TouchScreen_Calibr_kbv.ino sketch.

It is very useful to get your feedback.   e.g. disabling Fonts in UTFTGLUE.

David.

jcmojj

Hi again David,

I quoted the post here, that is also my first post at that forum. I read that forum for almost an year, but I never posted since we can easily find all info we need for almost every part we need. The problem is that those tft shield have lots of controllers that make quite confusing to find the info and the correct library to use. We are lucky that you made that library that try to work with almost every type of tft. To start with how could I put the slide bar at the quotes? The way you did at some quotes is better.

Lets come back to the TLT.
1) First test: I create a folder called bitmaps at my SD card and named my 320x240 file as tiger.bmp
I had a blue color at the screem.

Serial Monitor returns:
Quote
Show BMP files on TFT with ID:0x1520
cannot start SD
The compiler returned:
Quote
C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\showBMP_kbv_as7\showBMP_kbv_as7.ino: In function 'void loop()':

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\showBMP_kbv_as7\showBMP_kbv_as7.ino:54:14: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]

     if (f != NULL) {

              ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\showBMP_kbv_as7\showBMP_kbv_as7.ino: In function 'uint32_t read32(File&)':

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\showBMP_kbv_as7\showBMP_kbv_as7.ino:111:27: warning: left shift count >= width of type [enabled by default]

     result |= f.read() << 16;

                           ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\showBMP_kbv_as7\showBMP_kbv_as7.ino:112:27: warning: left shift count >= width of type [enabled by default]

     result |= f.read() << 24; // MSB
2) Second Test: I did as you said and changed the namebuf to "/" and corrected the if for my file:
Code: [Select]
if (strstr(nm, ".bmp") != NULL && strstr(nm, "imagem1") != NULL) {. I received the same message at the Serial Monitor and at the compiler and the same blue screen.


3) I didn't understand what should I change regarding the SPI, if you have any post or site I could check to do it.

4) I don't have the file diagnose_Touchpins.ino to run here

5) I run the TouchScreen_Calibr_kbv and the compiler had
Code: [Select]
C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:23:43: warning: large integer implicitly truncated to unsigned type [-Woverflow]

 UTFTGLUE myGLCD(0x9341, A2, A1, A3, A4, A0);

                                           ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino: In function 'void done()':

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:263:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         showNumI("LEFT ", TS_LEFT, 0, 138);

                                          ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:264:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         showNumI("RT   ", TS_RT, 100, 138);

                                          ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:265:41: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         showNumI("TOP  ", TS_TOP, 0, 150);

                                         ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:266:43: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         showNumI("BOT  ", TS_BOT, 100, 150);

                                           ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:278:38: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("LEFT ", TS_LEFT, 0, 186);

                                      ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:279:38: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("RT   ", TS_RT, 100, 186);

                                      ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:281:37: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("TOP  ", TS_TOP, 0, 198);

                                     ^

C:\Program Files (x86)\Arduino\libraries\MCUFRIEND_kbv-master\examples\TouchScreen_Calibr_kbv\TouchScreen_Calibr_kbv.ino:282:39: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     showNumI("BOT  ", TS_BOT, 100, 198);

                                       ^

C:\Program Files (x86)\Arduino\libraries\TouchScreen\TouchScreen.cpp:17:0: warning: "NUMSAMPLES" redefined [enabled by default]

 #define NUMSAMPLES 2

 ^

In file included from C:\Program Files (x86)\Arduino\libraries\TouchScreen\TouchScreen.cpp:9:0:

C:\Program Files (x86)\Arduino\libraries\TouchScreen\TouchScreen.h:9:0: note: this is the location of the previous definition

 #define NUMSAMPLES 3

 ^


The SM has
Quote
TouchScreen.h Calibration
I touched the display screen and nothing happened. It has some stuff written that tells me to touch the screen.

6) Running the GLUE Demo 320x240
Lots of images shows up. The touch doesn't change anything and I suppose they should not at this file. The deprecated conversion is just a warning so I didn't fix it.

7) How can I disable the Fonts in UTFTGLUE  as you suggested. Will it unable all the fonts library from Adafruit? I think it is really nice to have all those fonts available to use in the projects. We can include only the Fonts we are using to don't use all flash memory.

8) At my project I need to make a menu at the screen and use it as the buttons. As the person click at the menu the buttons changes. I have files as the UTFT glue that shows me examples of how can I print at the screen The problem now is to use the Touch and the SD card as it would be nice to put some images to use together with the buttons at the screen.

david_prentice

You have not realised the difference between QUOTE tags and CODE tags.

If your showBMP sketch said
Quote
cannot start SD
then it can never read your SD card.

The SD.h library expects to use pins 10, 11, 12, 13 on a Uno (like your Shield)
But it expects to use 50, 51, 52, 53 on a MEGA2560.

The only way for you to use SD.h with the "wrong pins" on a MEGA2560 is by setting a special SYMBOL value in the library.    The whole SD.h arrangement is pretty flaky.   On my v1.6.9 IDE,  you edit utility/Sd2Card.h:
Code: [Select]
#define MEGA_SOFT_SPI 1

Note that you probably need to run your Editor as administrator before Windows will let you edit
C:\Program Files (x86)\Arduino-1.6.9\libraries\SD\src\utility\Sd2Card.h

If you try this "fix",  you hould test the SD.h examples to make sure tat it works (when you use SD.begin(10); )

There is a similar arrangement with the third party SdFat.h library.  Edit
C:\Users\David Prentice\Documents\Arduino\libraries\SdFat\SdFatConfig.h:
Code: [Select]
#define SD_SPI_CONFIGURATION 3


I suggest that you write any new programs for Arduino_GFX.   i.e. use FreeFonts, GFX_Buttons, print() etc.

I am very reluctant to publish anything that involves SD.h or SdFat.h.
It is up to the punter to navigate these particular minefields.

Remember that you have chosen to buy a Uno Shield and then plug it into a non-Uno Arduino.

David.

p.s. the Sd2Card.h "fix" creates other Compilation problems.

AZ82


david_prentice

You can use whatever fonts you like.   However,   Adafruit_GFX is only expecting 8-bit character values.  (I think)

David.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy