Hello Community,
I'm on the verge of despair.
I've been trying for 2 days to get a Canvas example running so that I can later incorporate it into my code.
I want to try it with Canvas_Indexed later on, but at the moment, it seems to be failing at the very basics.
Please help!
What's happening:
The content of setup() is still being drawn. However, everything in loop() no longer appears on the display.
I've tried both flush() and draw16bitRGBBitmap().
#include <Arduino_GFX_Library.h>
/* Define the data bus and display settings */
Arduino_DataBus *bus = new Arduino_SWSPI(GFX_NOT_DEFINED /* DC */, 9 /* CS */, 10 /* SCK */, 11 /* MOSI */, 12 /* MISO */);
/* Initialize the display with appropriate parameters */
Arduino_GFX *output_display = new Arduino_ST7796(bus, 13 /* RST */, 1 /* rotation */, true /* IPS */, 272, 480, 0, 0, 24, 0);
Arduino_Canvas *canvas = new Arduino_Canvas(272 /* width */, 480 /* height */, output_display);
int value = 0;
void setup(void)
{
output_display->begin();
output_display->fillScreen(output_display->color565(50, 255, 255));
canvas->begin();
}
void loop()
{
// Fill canvas
canvas->fillScreen(canvas->color565(0, 255, 0));
canvas->fillRoundRect(value + 50, 50, 50, 50, 5, canvas->color565(255, 0, 0)); // Rounded rectangle with a red color - moving
canvas->fillRoundRect(50, 150, 30, 30, 5, canvas->color565(0, 0, 255)); // Rounded rectangle with a blue color
value = value + 10;
// Use the new method to transfer the buffer content to the display
//output_display->draw16bitRGBBitmap(0, 0, canvas->getFramebuffer(), 272, 480); // Doesn't work too!!!
canvas->flush();
delay(1000);
}
Does anyone have a working code for Arduino_Canvas or Arduino_Canvas_Indexed?