Hizem Mariem
Message Body:
Hello everyone,
I’m encountering a compilation error when trying to declare an external BOOL variable in OpenPLC and use it in my Arduino sketch for an ESP32-S2 project. Here are the details:

Context:

  • Hardware: ESP32-S2.
  • Software: OpenPLC Editor + Arduino IDE (with ESP32 library 3.2.0).
  • Goal: Declare a connect (BOOL) variable in OpenPLC and manipulate it via the Arduino sketch (e.g., read/write via Serial).

Problem:

The compilation fails with the following errors:
  1. implicit declaration of function '__GET_GLOBAL_CONNECT'
  2. assignment to 'IEC_BOOL*' from 'int' makes pointer from integer without a cast
Affected files:
  • POUS.c: Error related to __INIT_EXTERNAL(BOOL, CONNECT, ...) (bug.jpg).
  • Arduino sketch: Issue with Serial reading to set connect (bug4.jpg).

OpenPLC (Variable Declaration):

VAR_EXTERNAL connect : BOOL; // Déclaré comme externe ([bug3.jpg](bug3.jpg)) END_VAR
 

Arduino Sketch (Extrait) :

 
//////////////////////////////// sketch section ////////////////////////////////

String input = "";
void sketch_setup()
{
Serial.begin(115200);
Serial.println("Ready to receive open/close...");
}
void sketch_loop()
{
while (Serial.available()) {
char c = Serial.read();
if (c == '\n' || c == '\r') {
if (input == "open") {
connect = true; // OpenPLC uses 1/0 for BOOL
Serial.println("connect = TRUE");
} else if (input == "close") {
connect = false;
Serial.println("connect = FALSE");
}
input = "";
} else {

input += c;

}

}

}
 
 
 
 

Questions:

  1. How can I correctly declare an external variable in OpenPLC so it’s accessible in the Arduino sketch (ESP32-S2)?
  2. Are there any known limitations with ESP32-S2 and OpenPLC?
Thank you in advance for your help!
Reply 0 0
thiagoralves
Update your editor to the latest version (file -> check for updates) and it will work.
Reply 1 0
Hizem Mariem
Thank you for your help! Updating OpenPLC Editor resolved the compilation errors.
Reply 1 0
jblb
Hi,
Got the same problem with an Arduino Leonardo based PLC and editor seem to be at the latest version (OpenPLC editor 3.0 Release: 2025-09-15)
Reply 0 0
Reply