I'm completely new to Arduino. I have created an image and set it as background in full screen on the GIGA display screen. I have also found how to control the RGB led. now I would like to add a button on top of the background image but I cannot find any example that helps me on the way.
I have been playing with lvgl.h but that does overwrite my background image.
Can anybody help me on the way how add a simple button on my background image?
this is what i have so far:
#include "Arduino_H7_Video.h"
#include "ArduinoGraphics.h"
#include "Arduino_GigaDisplayTouch.h"
#include "Arduino_GigaDisplay.h"
#include "lvgl.h"
#define INCBIN_PREFIX
#include "incbin.h"
Arduino_H7_Video Display(800, 480, GigaDisplayShield);
Arduino_GigaDisplayTouch TouchDetector;
GigaDisplayRGB rgb;
// define background
INCBIN(bg, "/home/drone/Arduino/iDrone-fly/background.bin");
Image img_background(ENCODING_RGB16, (uint8_t *) bgData, 800, 480);
void set_background(){
// Draw background
Display.beginDraw();
Display.image(img_background, (Display.width() - img_background.width())/2, (Display.height() - img_background.height())/2);
Display.endDraw();
}
// define RGB control
enum Color { OFF, RED, GREEN, BLUE, WHITE };
void set_led(char color){
switch (color)
{
case OFF: rgb.off();break;
case RED: rgb.on(255, 0, 0);break;
case GREEN: rgb.on(0, 255, 0);break;
case BLUE: rgb.on(0, 0, 255);break;
case WHITE: rgb.on(255, 255, 255);break;
// etc
default: rgb.off();break;
}
}
void setup() {
// Start display
Display.begin();
rgb.begin();
TouchDetector.begin();
set_background();
set_led(OFF);
}
void loop() {
}