MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields

Hello first of all awesome working on the sketches But i have a problem I can not get my 3.5" LCD working on the m0 pro board then i found out I'm using the .org m0 pro board. I didn't know into a few days ago when i got it. I order it from mouser. But i would like to use the 3.5" Inch LCD on this board. If i put it on a uno board it works. Can you help me out? I know it's not a .cc board and not much help over there but can you please help me.

I also forgot this is where i got my LCD from Here

Joseph

I bought my ZERO PRO when it first became available in Europe. Before it was renamed as M0 PRO

D2 and D4 are swapped on my M0 Pro compared to the American Zero.

The macros in mcufriend_shield.h distinguish between the D2 / D4 wiring.

Please say which IDE, which M0, which D2 wiring, what you eat for breakfast, ...

Obviously we need to select the correct board in Tools. This determines the compile-time defines that the library uses.
My conditional tests can be improved.

It would be nice to hear from owners of the American Zero. Old or current.

David.

I'm using Arduino 1.7.10 From Arduino.org IDE, Board on the bottom says M0 PRO from Italy. not sure what you mean by D2 wiring? and what i ate this morning well nothing lol

Attached is the sketch below.

_3.5_TFT_DEMO.ino (1.18 KB)

My board says:

BOARD MODEL
ZERO PRO R3
OPEN-SOURCE ELECTRONICS
PROTOTYPING PLATFORM
ARDUINO.ORG
MADE IN ITALY
DEVELOPED BY Atmel
ROHS COMPLIANT

My board has D2 swapped with D4 pin.

Please compare your board with my board. And identify which SAMD port and bit is connected to D2 (Digital#2) header pin.

I had porridge for breakfast with 3 mugs of tea.

David.

Hello here are the images from my board. Hope this helps.

I was somehow getting problems with your 2.8 library not sure why. But guess what. It now works i have scrolling text penguin Icon LOL

That is good news.

I will enjoy it with my porridge.

David.

Hello David i have a couple of Questions. How do i tell text to Go X,Y as well as change font color on the text? I also couldn't figure out how to make the font go bigger or smaller? from the demo sketch that is in the library that is marked GLUE_Demo_480x320 which that is my screen size.

The library uses Adafruit style graphics methods from Adafruit_GFX class. Study the graphictest_kbv.ino example.

e.g. testText() function. which just uses the monospaced 7x5 system font.

If you use a current Adafruit_GFX you can use the Free Fonts which are a lot prettier.

David.

Okay learning more and more here. Can you tell me what this does 150+(i20), 70+(i20), 210+(i20), 130+(i20)) in?

myGLCD.fillRect(150+(i20), 70+(i20), 210+(i20), 130+(i20));

I know it makes the square boxes But what does each number and part do?

I am not at a PC. Your code looks like UTFT code. Look up the UTFT documentation.

MCUFRIEND_kbv uses Adafruit_GFX methods. Study the testFillRect() function in graphictest_kbv.ino

Adafruit does have some tutorials and PDF about GFX. Quite honestly, I just read the Adafruit_GFX.h file.

If the arguments are x, y, w, h, color it seems pretty intuitive. i.e. X position, Y position, Width, Height, Fill Colour

Obviously this is harder for non-English speakers.

David.

p.s. the UTFT methods are very difficult for humans to follow. i.e. you give bottom-right coordinates instead of width, height. And the Colour is specified elsewhere.

For the color i found it setColor(0,0,255); that is blue. I'm into a lot of RGB color stuff recently.

setColor() is a UTFT method.

If you really want to use UTFT methods in a new program, why don't you install and use UTFT?

If you want to make a colour from R, G, B with Adafruit, use the clor565(r, g, b) method.

David.

Hello David I been Trying different text sizes and font colors thank you for that. I didn't mange to get the x and Y location yet working but getting there. Again thank you for the library and help.

Have you visited the links in message #1085 ?

It is fairly easy to setCursor() to a specific (X, Y) position. And print some text in a font selected with setFont()

The best way to learn is to study the examples. Adapt them to do what you want. Experiment ...

David.

Some odd reason i didn't see that post. My browser didn't update when i refreshed i only see most of my Post. But i see it now i cleaned out my cookies and cache now I'm good.

MosheB:
Michel53.

well done on the hard workץ
I really liked the clock.
Can I get the code?
Thanks.

its not the same clock but it is pretty ... i spent a few hours getting it to work with the mcufriend library and instead of millis it uses a ds1302 rtc. i really just hacked that in there because whenever i remove the millis loop weird things happen.. wither way its a pretty clock now i need to add the touch screen part to make it have a dialog to set the rtc. its only related in the fact that it uses mcufriend_kbv and well i like to share code, if it was cleaned up a bit it would be a good example to add to the library maybe in case anyone wanted a quick easy analog clock.. :slight_smile:

Analog_320x240.ino (9.05 KB)

Incidentally, I just took one of Bodmer's example sketches from his TFT_ILI9341 library.
And changed two lines in TFT_Clock.ino:

...
//.kbv #include <TFT_ILI9341.h> // Hardware-specific library
#include <TFT_HX8357GLUE.h> //.kbv GLUE TFT_xxxx library methods to MCUFRIEND_kbv 
TFT_HX8357GLUE tft;        //.kbv constructor finds and uses correct controller

#include <SPI.h>

#define TFT_GREY 0x5AEB

//.kbv TFT_ILI9341 tft = TFT_ILI9341();       // Invoke custom library
...

I think that his illustrates just how easy it is to port / adapt sketches that use Adafruit_GFX style class methods.

I do not have tbillion's DS1302RTC library. So I could not build his sketch.
However I did note:

tft.begin(0x9325); //perlu address ini saat menggunakan lib.SPFD5408_Adafruit_TFTLCD.h

It is wiser to use:

  tft.begin(tft.readID()); //.kbv make sure that you use the actual controller on your Shield

David.