Skip to content

Commit 6713ec6

Browse files
committed
Periodically print ip and port of OPC UA enabled Opta device.
1 parent 4a7324c commit 6713ec6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/opta_opcua_server/opta_opcua_server.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,15 @@ void loop()
514514
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
515515
delay(500);
516516

517+
/* Periodically print OPC UA server IP and port. */
518+
static auto prev_ip_print = millis();
519+
auto const now = millis();
520+
if ((now - prev_ip_print) > 5000)
521+
{
522+
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "Arduino Opta IP: %s", Ethernet.localIP().toString().c_str());
523+
prev_ip_print = now;
524+
}
525+
517526
#if USE_MODBUS_SENSOR_MD02
518527
if (!ModbusRTUClient.requestFrom(MODBUS_DEVICE_ID, INPUT_REGISTERS, MODBUS_DEVICE_TEMPERATURE_REGISTER, 1)) {
519528
Serial.print("failed to read temperature register! ");

0 commit comments

Comments
 (0)