Link analog data from Arduino Giga Display Shield

Hello everyone,

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…

Seems you completely omit in setup config A0 And on STM you need check too if pin is AD capable.

Hello Marian

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
1 Like

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.

@Motivate9181: The official description for using Arduino GigaShield with SquareLine Studio:
https://docs.arduino.cc/tutorials/giga-display-shield/square-line-tutorial/?queryID=a8d7fe64071eda9bdd8161cf1e266d87&_gl=1*1ugx9ew*_ga*MjA0MzkxODI4Mi4xNzA4MzMwMDk3*_ga_NEXN8H46L5*MTcwODUwMDMwOC4yLjEuMTcwODUwMTI2Mi4wLjAuMA_fplcaTZMOUxGcXZTY2hQOUYzSDVwZzE2RXgwJTJCdktkMk1kSDdZeXhpS1RxZHEyaXA4Mm4lMkZWTzQlMkZjT1U4VWY5U051RElzNnAyczlheGd0cFlZVkkxREF6ZHYlMkZBOERCb2ZKbU9NUFlGcU5yJTJGbkp2MG15ZWdqTUNPT1BSZ0pZUzduZyUzRCUzRA

We already contacted Arduino for better support of their boards in the future in SquareLine Studio.

1 Like