Go Down

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

NobleNoob

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() {
  DrawMyRect();
}
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



PaulS

Quote
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.

NobleNoob

Thank you for the nudge in the right direction

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy