I want to use a variable that will be changed by ui.c in my main.c
If i declare the variable inside ui.c, then it is not recognized in the main.c (amd the opposite).
main.c
void loop()
{
serial.print(var1);
}
ui.c
int var1;
void ui_event_onoffpano(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
lv_obj_t * target = lv_event_get_target(e);
if(event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
var1=0;}
if(event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
var1=1; }
}
(The next step is to have a boolean value and switch a relay on and off-from a widget-).
Should i use it as a global? If yes, how?
What MCU/Processor/Board and compiler are you using?
ESP32
What LVGL version are you using?
8…3
Arduino edition
Arduino 1.8.19
Thanks in advance!