Trying to load bitmap in PROGMEM to TFT

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
methos1976
 
Posts: 8
Joined: Sat Nov 10, 2018 10:19 pm

Trying to load bitmap in PROGMEM to TFT

Post by methos1976 »

Hi everyone,

I have the following hardware:
Adafruit 1.44" color TFT LCD Display with micro SD card ST7735R
Arduino UNO

I have the display working with the demo and I have worked with some other libraries with the screen. I want to try and get an image to display which has been converted to hex in a header file called "Meter.h" and I am trying out the Adafruit_GFX and Adafruit_ST7735 libraries and i am currently getting a white screen.

Wonder if anyone has any ideas what i might be doing wrong. Code below.

Code: Select all


#include <Adafruit_GFX.h>  // Arduino LCD library
#include <Adafruit_ST7735.h>
#include <SPI.h> //for TFT

#include "Meter.h" // bitmap in PROGMEM

// pin definition for the Uno and TFT display
#define TFT_cs   10
#define TFT_dc   8
#define TFT_rst  9

//colours defined
#define Purple 0x69D2

//setup the screen with the defined pins
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_cs, TFT_dc, TFT_rst); 

void setup() {

 // initialize the serial port
  Serial.begin(9600);

tft.fillScreen(Black);

tft.setRotation(90); 

}

void loop() {

tft.drawBitmap(64,64,AudioMeter1,128,128, Purple);

}

for the bitmap i have created a tab and called it Meter.h and used the below syntax

Code: Select all


const unsigned char AudioMeter1 [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,..etc, etc
};

User avatar
blnkjns
 
Posts: 963
Joined: Fri Oct 02, 2020 3:33 am

Re: Trying to load bitmap in PROGMEM to TFT

Post by blnkjns »

The image is 32kB, the whole memory of the UNO. So that is nothing left for other code.
Either go with a palette style image (GIF-like) or swap the UNO for something more powerful

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”