I would expect my screen to change colours. Nothing happens. Which function am I missing now?
Thanks
#include "Arduino.h"
//#include "SPI.h"
#include "Arduino_GigaDisplay_GFX.h"
GigaDisplay_GFX tft;
#define GC9A01A_CYAN 0x07FF
#define GC9A01A_RED 0xf800
#define GC9A01A_BLUE 0x001F
#define GC9A01A_GREEN 0x07E0
#define GC9A01A_MAGENTA 0xF81F
#define GC9A01A_WHITE 0xffff
#define GC9A01A_BLACK 0x0000
#define GC9A01A_YELLOW 0xFFE0
#define WHITE 0xffff
#define BLACK 0x0000
void setup() {
Serial.begin(115200);
tft.begin();
tft.fillScreen(GC9A01A_GREEN);
yield();
delay(3000);
tft.fillScreen(GC9A01A_BLUE);
yield();
delay(3000);
tft.fillScreen(GC9A01A_YELLOW);
Serial.println("Done");
}
void loop() {
// put your main code here, to run repeatedly:
}
xfpd
January 31, 2024, 5:18pm
2
I do not know Giga, but other displays require a "x.display()" to show the display buffer.
Maybe try this before Serial.println("Done");
...
tft.display();
No, this did not work... I just tried this.
[edit] What is "yield()?"... I have not found a reference to it. i suspect it is meant to show the display buffer.
Somekind of wait statement, it is also used in the demo's.
xfpd
January 31, 2024, 6:27pm
4
Does a more simple sketch work?
#include "Arduino_GigaDisplay_GFX.h"
GigaDisplay_GFX display; // create the object
#define BLACK 0x0000
void setup() {
display.begin();
display.fillScreen(BLACK);
display.setCursor(10,10); //x,y
display.setTextSize(5); //adjust text size
display.print("Hello World!"); //print
}
void loop(){}
All the demos work. Ha Ha. But not my really simple sketch. Very weird.
xfpd
January 31, 2024, 6:29pm
6
Remove the yields() and run again...
Started without the yield. That did not work. So I assumed that maybe the yield would do a screen refresh.
Thanks
xfpd
January 31, 2024, 6:32pm
8
What does the sketch in post #4 do?
Now this I interesting. And before you call me crazy : I have been developing challenging software based on M5Stack and Arduino for years now. Ha Ha Ha
Anyway,
If I upload the demo sketch (post #4 ) to my Arduino Giga R1, correct driver, and main core, I see a nice red square on the screen at the correct position.
BUT, in addition I see a white dot moving from bottom to top and slowly to the left. This is because of the print to display statement in the loop I suppose
xfpd
January 31, 2024, 7:10pm
10
MeandMrsJones:
for years now. Ha Ha Ha
I know what it is like to be a beginner. I keep trying, too.
Wow,
The fullscreen in the setup does not do anything. In the loop the screen correctly switches from black to red and the small box from red to black.
This is driving me crazy.
//#include "Arduino.h"
//#include "SPI.h"
#include "Arduino_GigaDisplay_GFX.h"
GigaDisplay_GFX display;
#define GC9A01A_CYAN 0x07FF
#define GC9A01A_RED 0xf800
#define GC9A01A_BLUE 0x001F
#define GC9A01A_GREEN 0x07E0
#define GC9A01A_MAGENTA 0xF81F
#define GC9A01A_WHITE 0xffff
#define GC9A01A_BLACK 0x0000
#define GC9A01A_YELLOW 0xFFE0
#define WHITE 0xffff
#define BLACK 0x0000
int k;
bool Switcher;
void setup() {
delay(5000);
Serial.begin(9600);
delay(300);
Serial.println("we have begun");
display.begin();
yield();
delay(5000);
display.fillScreen(0x8888);
yield();
delay(3000);
display.fillScreen(0);
yield();
delay(3000);
display.fillScreen(0x8888);
yield();
Serial.println("Done");
}
void loop() {
if (Switcher)
{
display.fillScreen(0);
display.fillRect(k+120, 180, 120, 180, 0x8888);
}
else
{
display.fillScreen(0x8888);
display.fillRect(k+120, 180, 120, 180, 0);
}
Switcher=!Switcher;
k++;
delay(100);
}
Lets hope than that a more professional member can help me solve this.
KurtE
February 5, 2024, 2:29pm
14
Probably does not include me, as I am retired and as such no longer professional (i.e. no longer getting paid )
I can confirm, that your sketch where it is only doing fillScreen is not showing those screens.
But if for example I have it display some text with it, then they show up:
//#include "Arduino.h"
//#include "SPI.h"
#include "Arduino_GigaDisplay_GFX.h"
GigaDisplay_GFX display;
#define GC9A01A_CYAN 0x07FF
#define GC9A01A_RED 0xf800
#define GC9A01A_BLUE 0x001F
#define GC9A01A_GREEN 0x07E0
#define GC9A01A_MAGENTA 0xF81F
#define GC9A01A_WHITE 0xffff
#define GC9A01A_BLACK 0x0000
#define GC9A01A_YELLOW 0xFFE0
#define WHITE 0xffff
#define BLACK 0x0000
int k = 0;
bool Switcher;
void setup() {
while(!Serial && millis() < 5000) {}
Serial.begin(9600);
delay(300);
Serial.println("we have begun");
display.begin();
// delay(5000);
display.fillScreen(GC9A01A_RED);
display.setCursor(100, 100);
display.setTextColor(WHITE);
display.setTextSize(4);
display.print("RED");
delay(3000);
display.fillScreen(GC9A01A_GREEN);
display.setCursor(100, 100);
display.print("GREEN");
delay(3000);
display.fillScreen(GC9A01A_BLUE);
display.setCursor(100, 100);
display.print("BLUE");
delay(3000);
Serial.println("Done");
}
void loop() {
if (Switcher) {
display.fillScreen(0);
display.fillRect(k + 120, 180, 120, 180, 0x8888);
} else {
display.fillScreen(0x8888);
display.fillRect(k + 120, 180, 120, 180, 0);
}
Switcher = !Switcher;
k++;
if ((k+120) >= display.width()) k = 0;
delay(100);
}
However your loop stuff shows some interesting stuff...
I added stuff to not run off the right hand edge, but the internal rect is also moving around vertically as well...
KurtE
February 5, 2024, 3:26pm
15
The display library, has it's own version of fillScreen, which did not
set the trigger to redraw the screen.
Created a Pull Request:
fillScreen: trigger a redraw of the screen by KurtE · Pull Request #3 · arduino-libraries/Arduino_GigaDisplay_GFX (github.com)
Will see if/when it might be pulled in and new version released.
In the mean time you can edit your current version of the library (Arduino_GigaDisplay_GFX.cpp) and
update the fillScreen code:
void GigaDisplay_GFX::fillScreen(uint16_t color) {
if (hasBuffer()) {
startWrite();
uint8_t hi = color >> 8, lo = color & 0xFF;
if (hi == lo) {
memset(buffer, lo, WIDTH * HEIGHT * 2);
} else {
uint32_t i, pixels = WIDTH * HEIGHT;
for (i = 0; i < pixels; i++)
buffer[i] = color;
}
endWrite();
}
}
It believe that in the original demo there is a print to screen in the loop which makes a dot move on the screen. Ha Ha
Thank you, one issue on the path to be solved then. Ha Ha