#include <SoftwareSerial.h>
SoftwareSerial serial(2, 3); // RX, TX
void setup() {
serial.begin(9600); // start serial communication at 9600 baud rate
}
void loop() {
// Send the message to the API
serial.println("GET /api/message HTTP/1.1");
serial.println("Host: localhost:3000");
serial.println();
Serial.println("Response: ");
// Wait for the response from the API
while (serial.available()) {
String response = serial.readString();
Serial.println("Response: " + response);
}
delay(1000); // wait for 1 second before sending the next request
}