MicroBlocks NEW Features #2 - TFT Library Support

Turgut
edited April 2023 in MicroBlocks Support

This one will be of great interest to PicoBricks Users. It is available in the Pilot release 1.2.20 FW 188 now, and will be in the next stable release, early next week.

As you know, the OLED Graphics Library is the one you have been using for displaying anything on the OLED display. However, with all it's great features like buffered compositions, animations, wrap control, sprites, etc, it exacts a heavy memory toll on your projects at 26K.

To lighten up the memory footprint at the expense of a some features, we are now supporting display capability using the TFT Library. With only a 3K size, it is the perfect tool for projects that do not need all the fancy capabilities of the OLED Graphics Library.

You can display simple geometric shapes and write text. You get the benefit of full set of 256 ASCII characters, as opposed to the 96 character set of the OLED Library. Text can be scaled from 1 to 21, allowing you to highlight parts of your information display.

While the TFT Library blocks support full color range of various displays, the OLED display being black & white, there are only two options: black or any other color value displayed as white.

To assist with display refresh issues, there are two new blocks: defer and resume TFT display updates. These allow the user to print something to the display without actually showing it on the screen, until the resume block is executed.

We have provided an example program (PicoBricks Test) in the File / Open / Other / Examples menu, to help anyone start to experiment with the Library. It will display some of the sensor values of the PicoBricks kit.

In the example program, we are using the defer feature to collect all four sensor values, right-justify them, and write them, before resuming the display updates and actually displaying the end result.


NOTES:

  1. If you have any projects written to work with the original OLED Graphics Library, and you want them to work with the TFT Library, you will need to modify your code to use the TFT Library blocks. Your old code will not function automatically with the new library.
  2. The two Libraries have their own respective buffers. While it is technically possible to engage both of them, you will not be able to combine the display buffers from the two different libraries. However, you can use them in the same project one at a time, paying attention to which one has control of the display.

Enjoy.

Comments

  • PeterMathijssen
    edited April 2023

    Made a Tweet about this and posted it on the MicroBlocks Discord server. This is great.

  • as I am new to this I have 2 questions...

    1) is there a picobricks temperature (F) instead of (c)

    2) where is Gods name is the display command that you can enter 'display picobricks humidity line 4

    I have looked in all the libs and could not find a display command where you can enter a variable.

    Thanks,

    Roy

  • Turgut
    edited August 2023

    Hi Roy,

    Welcome to MicroBlocks and Picobricks.

    The light blue DISPLAY block is a user coded function that can be found under My Blocks selection on the left side menu.

    It was coded to make it easier to right-justify the output. I have included the code below.


    As far as the Fahrenheit display goes, you can do the math conversion using formula: °F = (9/5) * °C + 32

    Since MicroBlocks is an Integer math environment, the calculations will lack a certain level of precision. To compensate for that, I am presenting two versions of the formula:

    • one with integer math, without decimal positions
    • one with a single decimal position accuracy. ( Achieved by first multiplying the TEMP by 90 and then adding 320)

    Both scripts are below:

    Enjoy.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!