This library allows you to receive messages through a network into a console window.
- Make HTTP requests async/non-blocking.
- Server: Receives messages and prints to console.
- Library: Sends the messages from the device to your PC.
- Go to your project folder.
- Open or create and open the 'lib' folder.
- Run the command (ensure you have git installed)
git clone https://github.com/c-ridgway/arduino-remoteserial.git
- Install node.js https://nodejs.org/en/download/current
- Open the library directory:
lib/arduino-remoteserial/server
- Open
start_nodejs_server
Insert your ip address in to match your server machine, as seen in the above image.
I assume you will already be connecting via WIFI. This is the only requirement.
// Add to your header section
#include <RemoteSerial.h>
void setup() {
// Url (your ip address), flush interval, flush failure retry delay
RemoteSerial.begin("http://192.168.1.108:10000/remoteserial", 100, 1000);
RemoteSerial.clear(); // Completely clear the console
RemoteSerial.println(clock()); // Send current time on its own line, it'll be sent once the wifi has connected
RemoteSerial.cprintln("[#13F700]Colour [#F74B00]your text. [#] Or keep it normal."); // Send coloured output, on its own line
//RemoteSerial.shell("ls"); // Run shell command, must be enabled in server code
}
void loop() {
if (clock() % 1000 == 0) // Once a second
RemoteSerial.print(clock()); // Print without a new line, once a second
RemoteSerial.tick();
}