I'm having a problem. I want to clear the screen on the connected console. And after the clear, I want to rerun my code. But i can't seem tu figure out how to do it. Below is some part of the code:
#include <motorStyring.h>
#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>
#define PORT 6666
motorStyring mt;
int cm;
YunServer server(PORT);
const int pingPin = 9;
int led = 13;
void setup() {
Serial.begin(115200);
Bridge.begin();
server.noListenOnLocalhost();
server.begin();
}
void loop() {
long duration, inches, cm;
pinMode(pingPin,OUTPUT);
digitalWrite(pingPin,LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin,LOW);
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin,HIGH);
cm = microsecondsToCentimeters(duration);
h();
}
void h()
{
YunClient client = server.accept();
if (client.connected()) {
String question = "What would you like to drink?\nyou have 4 choises:\n1)Juice\n2)Vodca\n3)Soda\n4)Mix\n";
client.write((uint8_t*)&question[0], question.length());
String response;
while (client.connected()) {
if (client.available()) {
char cmd = client.read();
if (cmd == '\n') {
break;
} else {
response += String(cmd);
}
}
}
if (response == "juice") {
juice();
} else if (response == "vodka") {
vodka();
} else if (response == "soda") {
soda();
} else if (response == "mix") {
mix();
} else {
String error = "you didn't select anything that corrospond to an option. \n try agin";
client.write((uint8_t*)&error[0], error.length());
}
String awnser = "Here is your " + response;
client.write((uint8_t*)&awnser[0], awnser.length());
}
delay(1000);
}
...
Is there a way to clear the screen on the console, so that all of the text from the previous code is not disturbing the user ?