Go Down

Topic: Flash & Methods (Read 751 times) previous topic - next topic


Heys guys;

Here is my code:

#include <Flash.h>
#include <UTFT.h>

UTFT tft(ITDB32S, 38, 39, 40, 41);

FLASH_TABLE(int, fTable, 4, {0,0,10,100}, {0, 40, 40, 150});

void setup() {
void loop() {


void DrawMyRect() {
  tft.drawRect(fTable[0][0], fTable[0][1], fTable[0][2], fTable[0][3]);  // DOES NOT DISPLAY
  tft.drawRect(0, 0, 10, 100);  // WORKS

If I try a Serial.println(fTable[0][0], fTable[0][1], fTable[0][2], fTable[0][3]);
The serial monitor display's the correct information, any ideas would be appreciated


any ideas would be appreciated

Where are you storing your table? Not in SRAM where the drawRect() method is expecting it. You are storing it in Flash (PROGMEM) memory. The Print::print() method is overloaded to deal with data in Flash. The UTFT::drawRect() method is not. You'll need to look at the Flash methods for retrieving data stored in PROGMEM.

For an 8 element array of ints, I can't see the benefits of moving that small an array to PROGMEM.
The art of getting good answers lies in asking good questions.


Thank you for the nudge in the right direction

Go Up