I recently got myself a PMC to develop a small industrial application. I followed the setup instructions and the board works as intended. I managed to test a few applications written in LD and encountered no problems.
I am now trying to add WiFi to my project in order to communicate with several nearby wireless sensors. The PMC should be configured as a WiFi access point running a local webserver. The wireless sensors sensors would send information to the server. The information from the sensors is used by the PMC in the LD program for different functions.
I have found examples of using the Portenta H7 as a WiFi access point running a webserver here and example of passing variables between the sketch and PLC language layer for an Arduino OPTA here. So from my understanding it should be possible to implement this on the PMC with the PLC IDE.
For now I have attempted just to configure the PMC as an access point with no success.
In the sketch tab of the PLC IDE I wrote the following code:
#include <WiFi.h>
char ssid[] = "PMC_AP";
char pass[] = "password";
int keyIndex = 0;
int status = WL_IDLE_STATUS;
WiFiServer server(80);
void setup() {
Serial.begin(9600);
WiFi.beginAP(ssid,pass);
Serial.println("Setup");
}
void loop() {
Serial.println("Loop"); // to check if looping
delay(1000);
}
I have also defined the WiFi library in the appropriate table (Version 1.2.7).
The code compiles without errors and I am also able to download it on the PMC. The problem is that it does not appear to be working. There is no new AP nearby with the programmed name and there is nothing appearing on the serial monitor.
Another problem is that once uploaded, I cannot connect to the PMC via the PLC IDE. The IDE just freezes when attempting to connect and has to be closed via Task Manager. When reinitialising the board as in the setup instructions, I am able to connect again.
I have tried small other code snippets using different libraries (not WiFi specific) and the results were similar.
Is there something I am missing? Or is it just impossible to do? I was not able to find much information on this topic, and the official documentation is also not helping much.
Some help would be greatly appreciated.