Jump to content
Rei Vilo

[Energia Library] LCD_screen Library Suite

Recommended Posts

Hello, I'm using screen ili9340 ( 2.2 w/ micro sd card slot) by RobG with the tiva c microcontroller and Energia  and am having trouble displaying data from a dht11 temperature sensor I'm using to the screen. Could someone please report me in the right deirection to get thid accomplished? I can write text to the screen with:


myScreen.gText((myScreen.screenSizeX()-10*myScreen.fontSizeX())/2, (myScreen.screenSizeY()-myScreen.fontSizeY())/2, "Hello World!", colour_white);


I can view the sensor data in the serial monitor using Serial.print. Any help getting the data on the screen would be greatly appreciated.



Share this post

Link to post
Share on other sites

Yes, the example program provided with the library works fine. I just can't figure out how to display anything but that program or a predifined text that I tell it to display. Sorry if I am missing something here and making it more complicated than it needs to be

Share this post

Link to post
Share on other sites

Try something like that

#include "SPI.h"
#include "Screen_ILI9340.h"
Screen_ILI9340 myScreen;

void setup()
                   "Hello", myColours.white);

void loop()

Share this post

Link to post
Share on other sites

I guess I don't have the Screen_ILI9340.h or Screen_ILI9340.cpp files I need. I have distribitions 107, 113, and 122beta of the LCD library suite and can't find them anywhere. What I have been using is from the Screen_ILI9340.zip file I found on here. If I try using the Screen_ILI9340_Library.h and Screen_ILI9340_Library.cpp files in that, but remove the Library from the filename I get some errors when compiling the program using them in distribution 122beta. This is the only distribution I have found to give ILI9340 as a choice for that screen, other than the Screen_ILI9340.zip file. Do you know where I can find these files? Thanks again for your help with this, I appreciate it very much!



Share this post

Link to post
Share on other sites

You're right, I haven't released the files for the ILI9340 screen in the LCD_screen Library Suite.


Instead, there were released as a standalone library.


You can find and download it at [Energia Library] LCD_screen Library Suite on the sister forum 43oh.


I know, dealing with two forums for the LaunchPads is really a mess :( . So please visit the two forums.



Share this post

Link to post
Share on other sites

I know having to deal with two forums on the same topic is everything but easy.


Please visit the thread [Energia Library] LCD_screen Library Suite at 

You may find relevant information in the other forum. 


Thank you!

Share this post

Link to post
Share on other sites


This is quite easy.


1. Change the constructor of the ILI9225 object for


#if defined(ENERGIA) // LaunchPads specific

Screen_ILI9225B::Screen_ILI9225B(uint8_t version)


                                    // Pin number / LaunchPad MSP430 / LM4F120 TM4C123

    _pinScreenCS            = 2;    // 2  / P1_0 / PB_5;

    _pinTouchClock          = 7;    // 7  / P1_5 / PB_4;

    _pinTouchMOSI           = 15;   // 15 / P1_7 / PB_7;

    _pinTouchMISO           = 14;   // 14 / P1_6 / PB_6;

    _pinScreenDataCommand   = 6;    // 6  / P1_4 / PE_5;

    if (version == 1) {

        _pinTouchCS         = 9;    //  9 / P2_1 / PA_6;

    } else {

        _pinTouchCS         = 10;   // 10 / P2_2 / PA_7;


    _pinReset               = 11;   // 11 / P2_3 / PA_2;


I'm using the pin numbers instead of the pin names.
If you want to place the screen on the second BoosterPack,
  • just add 40 to the pin numbers
  • and change the SPI port from 2 to 5 (not tested yet)

    SPI.setModule(2); // SPI 2 for BoosterPack 1

    SPI.setModule(5); // SPI 5 for BoosterPack 2
2. Each time there's a 

#if defined(__LM4F120H5QR__)


add to it


#if defined(__LM4F120H5QR__) || defined(__TM4C123GH6PM__) 

My project compiles and works perfectly when I use embedXcode but no longer when I use Energia :o


I changed the required lines and the code compiles and uploads, but there are a few issues.  

When using the test ino script:

1. the text on the squares is not rendered

2. The text rendering screen takes 5 and 7 seconds, way longer than my 123


The speed is just so slow, is there something in the clock divider settings that I need to tweak?

Share this post

Link to post
Share on other sites

Sometimes, the colour of the text is the same as the background of the rectangle. Try another colour.


To speed SPI up, just use the trick described at http://github.com/energia/Energia/issues/365

Definitely sped things up about 5 times.  Are these considered normal?

*** LCD_protocol
(All times in ms)
LCD 2.2 Touch BoosterPack
Square(100) 102
Square(50) 26
10xFontSolid(true) 1580
10xFontSolid(false) 3005
Ratio% 52
Original(=1) 390
point(readPixel()) 368
copyPaste() 0

Share this post

Link to post
Share on other sites

Here are the result with a LaunchPad Stellaris LM4F120:

*** LCD_protocol
(All times in ms)
begin... done
LCD 2.2 Touch BoosterPack
Font Number.4
Font Average.209



Share this post

Link to post
Share on other sites

The LCD_screen Library Suite release 225 supports a wide selection of screens on different platforms, including Energia, Teensy and Arduino.

  • Screen_ER1963 and Screen_ER1963_SD
  • Screen_ER8875 and Screen_ER8875_SD
  • Screen_HI32
  • Screen_HX8353E
  • Screen_HY28A
  • Screen_HY28A_SRAM
  • Screen_ILI9225B
  • Screen_ILI9340
  • Screen_K35
  • Screen_K35_SPI
  • Screen_K70
  • Screen_PICadillo
  • Screen_PicasoSGC
  • Screen_PicasoSPE
  • Screen_ST7735
  • Screen_W32

Share this post

Link to post
Share on other sites



i am searching for a quick start guide for TM4C123GXL-Launpad with a Kentec 3,5" Boosterpack using Energia. Can someone tell me where to find something like this?


Or can you tell me how to use any example at  LCD_screen Library Suite


I copied the LCD_Screen-, SD- and FDW-Dir to my sketchbook-location and can now choose examples. But i'm not sure how to use this examples, because the includes are confusing for me. I allways get compilation-errors like:

LCD_GUI_demo.cpp:58:31: fatal error: HY28A_SRAM_screen.h: No such file or directory
 #include "HY28A_SRAM_screen.h"
compilation terminated.

Similar Files in LCD_Screen are Screen_HY28A_SRAM.h, but if i change file-names it dosn't work either...


i would be very thankful if someone could help me...

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...