diff --git a/examples/1_SimpleTestShapes/1_SimpleTestShapes.ino b/examples/1_SimpleTestShapes/1_SimpleTestShapes.ino index 80f2236..3e384b5 100644 --- a/examples/1_SimpleTestShapes/1_SimpleTestShapes.ino +++ b/examples/1_SimpleTestShapes/1_SimpleTestShapes.ino @@ -20,70 +20,49 @@ //P3RGB64x32MatrixPanel display; -void setup() { +// Input a value 0 to 255 to get a color value. +// The colours are a transition r - g - b - back to r. +// From: https://gist.github.com/davidegironi/3144efdc6d67e5df55438cc3cba613c8 +uint16_t colorWheel(uint8_t pos) { + if(pos < 85) { + return dma_display.color565(pos * 3, 255 - pos * 3, 0); + } else if(pos < 170) { + pos -= 85; + return dma_display.color565(255 - pos * 3, 0, pos * 3); + } else { + pos -= 170; + return dma_display.color565(0, pos * 3, 255 - pos * 3); + } +} - - Serial.begin(115200); - - Serial.println("*****************************************************"); - Serial.println(" HELLO !"); - Serial.println("*****************************************************"); - - dma_display.begin(); // use default pins - - // draw a pixel in solid white - dma_display.drawPixel(0, 0, dma_display.color444(15, 15, 15)); - delay(500); - - // fix the screen with green - dma_display.fillRect(0, 0, dma_display.width(), dma_display.height(), dma_display.color444(0, 15, 0)); - delay(500); - - // draw a box in yellow - dma_display.drawRect(0, 0, dma_display.width(), dma_display.height(), dma_display.color444(15, 15, 0)); - delay(500); - - // draw an 'X' in red - dma_display.drawLine(0, 0, dma_display.width()-1, dma_display.height()-1, dma_display.color444(15, 0, 0)); - dma_display.drawLine(dma_display.width()-1, 0, 0, dma_display.height()-1, dma_display.color444(15, 0, 0)); - delay(500); - - // draw a blue circle - dma_display.drawCircle(10, 10, 10, dma_display.color444(0, 0, 15)); - delay(500); - - // fill a violet circle - dma_display.fillCircle(40, 21, 10, dma_display.color444(15, 0, 15)); - delay(500); - - // fill the screen with 'black' - dma_display.fillScreen(dma_display.color444(0, 0, 0)); - - - // draw some text! +void drawText(int colorWheelOffset) +{ + + // draw text with a rotating colour dma_display.setTextSize(1); // size 1 == 8 pixels high dma_display.setTextWrap(false); // Don't wrap at end of line - will do ourselves dma_display.setCursor(5, 0); // start at top left, with 8 pixel of spacing uint8_t w = 0; - char *str = "ESP32 DMA"; - for (w=0; w<9; w++) { - dma_display.setTextColor(dma_display.color565(255, 0, 255)); + const char *str = "ESP32 DMA"; + for (w=0; w