Running arduino commands in lv_demo_printer(); Super basic question (hopefully :))

Description

I have adapted the lv_printer_demo() and call it from a arduino file as suggested in many lvgl examples.

run arduino.ino >> call lv_demo_printer(); from the setup function. The code executes within lv_examples\src\lv_demo_printer.c.

All works great. However I would be very grateful if you could help me with:

When I run any arduino commands in the lv_demo_printer.c such as Serial.println, etc it does not compile. This might be super basic, but how can I issue arduino commands in this file? I have tried #include <arduino.h> at the top of the file but it still does not compile.

What MCU/Processor/Board and compiler are you using?

ESP32

What LVGL version are you using?

7.9.0

What do you want to achieve?

Be able to issue Serial.println commands to debug my code within lv_demo_printer.c. I am using this as an example. Really I want to upload a struct using the EEPROM library, but gain this will not work because I can’t access arduino commands from within this file.

What have you tried so far?

You won’t be able to do this, as the demo is written in C, and Arduino functions require C++ AFAIK. You would have to move the demo code to a C++ file and fix any of the syntax errors that arise.

Thanks for that @embeddedt, at the very least this will stop me from trying :slight_smile:

I guess I can run a handler in the main loop to change global variable values and interact that way.