Yeah I was looking into that but I was wondering if I get a string with multiple terminator char what does it do ?
Ex: My received string is "C/L/120"
I would do something like command = client.readStringUntil('/'); what command is going to have inside only C or it's going to give me and array of everything?
For anyone who is interested I figured out how to do it. Here is my test code
#include <Bridge.h>
#include <Console.h>
#include <YunServer.h>
#include <YunClient.h>
// The pin that the LED is attached to
const int ledPin = 13;
// We open the socket 5678 to communicate.
YunServer server(5555);
void setup() {
Serial.begin(9600);
// Attach the LED to pin 13 as output
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
// Bridge startup
Bridge.begin();
server.noListenOnLocalhost();
server.begin();
}
void loop() {
YunClient client = server.accept();
// There is a new client
if (client) {
client.setTimeout(5);
String command = "none";
digitalWrite(ledPin, LOW);
String test[2];
while (!command.equals("stop")) {
if (client.available() > 0) {
command = client.readStringUntil('/');
Serial.println("Reading Command :" + command);
if (command != "") {
// trim off any whitespace:
command.trim();
test[0] = command.substring(0);
// convert to an int and map to the screen height:
Serial.println("Command 1: " + test[0]);
}
command = client.readStringUntil('/');
if (command != "") {
// trim off any whitespace:
command.trim();
test[1] = command.substring(0);
// convert to an int and map to the screen height:
Serial.println("Command 2: " + test[1]);
}
}
}
}
}