You can do the following:
24V I/O Configuration:
To interface with 24V I/O from an Arduino board such as Portenta Machine Control, you typically need to use relays or interface modules to convert the 24V signals to voltage levels supported by the board, which is typically 3.3V or 5 V. Make sure the 24 V I/O configuration is appropriate and that you are using the appropriate components for signal conversion.
Programming in the Arduino IDE:
You can use the Arduino IDE to program the Portenta machine control. Make sure you have correctly configured the I/Os in your code to interact with 24V signals. You use the read and write functions of digital pins to control these I/Os. You can find examples and tutorials online on how to do this.
HTTP requests:
To make HTTP requests from your Portenta board, you can use the “WiFiClient” library to establish a connection to the Internet and the “HTTPClient” library to make HTTP requests. These libraries are available in the Arduino IDE and can be used to send data to a web server or perform other online actions.
Below is a basic example of how to make an HTTP GET request with the "HTTPClient" library:
#include <WiFiNINA.h>
#include <HTTPClient.h>
const char* ssid = "nombre_de_tu_red";
const char* password = "tu_contraseña";
void setup() {
Serial.begin(9600);
while (!Serial);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin("http://tu_servidor.com/tu_ruta");
int httpCode = http.GET();
if (httpCode > 0) {
String payload = http.getString();
Serial.println(payload);
}
http.end();
}
delay(5000); // Realizar la solicitud cada 5 segundos (ajusta según tus necesidades)
}
Make sure to modify the "ssid", "password" and URL variables in the example according to your configuration.
PLC IDE:
If you prefer to use the PLC IDE for HTTP requests, make sure you are following the documentation and tutorials specific to that environment. There may be differences in the way certain tasks are performed compared to the standard Arduino IDE.
In summary, to interact with 24V I/O and make HTTP requests from your Portenta Machine Control board, make sure you configure the I/O correctly, use the appropriate libraries in the Arduino IDE, and follow the best practices for each task. Also, keep in mind that Portenta Machine Control-specific documentation and resources may be helpful for your project.
I hope it helps