Post by grey on Sept 1, 2020 13:09:28 GMT -8
Hi I'm pretty new to the gameduiono, so still learning.
My previous experience is with using an il9342 tft display in my projects, but for my latest project I wanted a bigger screen.
I have my gameduino connected to a teensy 3.6, and so far its been working great.
However I'm having problems with the text commands working with an array of charachters.
What I want to achieve is for a graphic keyboard to dynamically change in response to different settings.
So I created an array of the letters (the notes of a musical keyboard) and tried to print them out on screen:
Code:
I don't understand why this does not work, instead of printing out the first 16 letters in the array, I just get a line of "Y"'s
I've ran code like this before with the il9341 and it worked perfectly, so what is different for the GD?
My previous experience is with using an il9342 tft display in my projects, but for my latest project I wanted a bigger screen.
I have my gameduino connected to a teensy 3.6, and so far its been working great.
However I'm having problems with the text commands working with an array of charachters.
What I want to achieve is for a graphic keyboard to dynamically change in response to different settings.
So I created an array of the letters (the notes of a musical keyboard) and tried to print them out on screen:
Code:
#include <EEPROM.h>
#include <SPI.h>
#include <GD2.h>
void setup()
{
GD.begin(0);
}
char notes[] = {'C', 'C', 'D', 'D', 'E', 'F', 'F', 'G', 'G', 'A', 'A', 'B', 'C', 'C', 'D', 'D', 'E', 'F', 'F', 'G', 'G', 'A', 'A', 'B', 'C', 'C', 'D', 'D', 'E', 'F', 'F', 'G', 'G', 'A', 'A', 'B',
'C', 'C', 'D', 'D', 'E', 'F', 'F', 'G', 'G', 'A', 'A', 'B', 'C', 'C', 'D', 'D', 'E', 'F', 'F', 'G', 'G', 'A', 'A', 'B', 'C', 'C', 'D', 'D', 'E', 'F', 'F', 'G', 'G', 'A', 'A', 'B',
'C', 'C', 'D', 'D', 'E', 'F', 'F', 'G', 'G', 'A', 'A', 'B', 'C', 'C', 'D', 'D', 'E', 'F', 'F', 'G', 'G', 'A', 'A', 'B',
}; // 96 notes (8 octaves)
int i = 0;
char notex = "a";
uint16_t ix = 0;
int reloop = 0;
uint16_t xa = 0;
uint16_t ya = 0;
uint16_t yb = 0;
void loop()
{
if (reloop == 0)
{
reloop = 1;
GD.ClearColorRGB(00000000);
GD.Clear();
GD.ColorRGB(255, 255, 255);
for (int i = 0; i <= 15; i++)
{
int xa = 25 + i * 50;
GD.cmd_text(xa, 440, 29, OPT_CENTER, notes);
}
GD.swap();
}
}
I don't understand why this does not work, instead of printing out the first 16 letters in the array, I just get a line of "Y"'s
I've ran code like this before with the il9341 and it worked perfectly, so what is different for the GD?