I’m new and have already made a GUI. Now I have programmed a text area and it works great graphically. I’m using an Arduino Giga Board with Shield. Everything runs and implements great. Now I would like to display analog values with the text area.
How can I link an analog value in the sketch?
So i think my problem is on the loop where is the funktion " /* Feed LVGL engine */
lv_timer_handler();" in my case i analogread in loop, but display flickers heavily?
Are there basics that I can use? Square Line Studio exports great, but now I want to feed the individual widgets with data. Can anybody help me with this? Thanks!
#include "Arduino_GigaDisplayTouch.h"
#include "lvgl.h"
#include "ui.h"
/* Insert resolution WxH according to your SquareLine studio project settings */
Arduino_H7_Video Display(800, 480, GigaDisplayShield);
Arduino_GigaDisplayTouch Touch;
int analogValue = 0;
void setup() {
Display.begin();
Touch.begin();
ui_init();
}
void loop() {
analogValue = analogRead(A0);
Serial.println(analogValue);
/* Feed LVGL engine */
lv_timer_handler();
}
type or paste code here
So update… i have been tested with an ESP 32 and ST7735 Display and it works great. Seems to be the giga and shield have problems with it, or that libary.
Strange…
i have the Arduino giga board with has ADC from A0-12. So no problem.
i use now a comparator. It works great:
#include "Arduino_GigaDisplayTouch.h"
#include "lvgl.h"
#include "ui.h"
#include "Wire.h"
#include <Adafruit_ADS1X15.h>
/* Insert resolution WxH according to your SquareLine studio project settings */
Arduino_H7_Video Display(800, 480, GigaDisplayShield);
Arduino_GigaDisplayTouch Touch;
Adafruit_ADS1115 ads; /* Use this for the 16-bit version */
void setup() {
Display.begin();
Touch.begin();
Serial.begin(115200);
Wire.begin(); //SDA & SDL
ads.begin();
ads.setGain(GAIN_TWO);
ui_init();
}
void analogRead() {
int16_t adc0;
adc0 = ads.readADC_SingleEnded(0);
Serial.println(adc0);
// Eine kleine Verzögerung, um den seriellen Monitor nicht zu beeinträchtigen
delay(10);
}
void loop() {
/* Feed LVGL engine */
lv_timer_handler();
analogRead();
}`Preformatted text`
also whit declarition in setup, whit pinmode.... it doesn´t work.
type or paste code here
Hello, I would be extremely grateful if you could share how you managed to successfully export and upload your UI from squareline to the giga display shield. I have spent a couple of weeks of frustration trying to get anything from squareline to work on the display shield, even a blank ui with a single screen and no UI elements.
For several days, I couldn’t even get the a minimal .ino file to compile with #include “ui.h”, but it at least is now compiling and uploading. However, the display shield now seems to crash the mbed os (indicated by flashing red BOOT0 LED) when the arduino reaches the " ui_init();" line of the setup.
Any advice that anyone can provide would be greatly appreciated.
@Chezz: I guess you’d like to display a continuously changing value in a Label-widget, coming from a sensor. Yes, it’s a good idea to do it in the main loop. If it flickers too much or too fast you might need to use a counter/prescaler to slow down the label-updates to be more readable by humans.