Hello everyone,
I am a complete noob when it comes to Arduino programming, Basically I want , that if the user does not type anything in serial monitor for at least 3 seconds then the serial monitor prints "??" or something else.
I hope you all can help!
You should start with the examples which are aimed to n00bs. I am sure you can find answer there.
For any further advice it is better post your code.
system
August 2, 2019, 10:31am
3
How's this?
// https://forum.arduino.cc/index.php?topic=629508
// 2 august 2019
// remind user for serial input
int interval = 3000;
unsigned long startTheClock;
char receivedChar;
void setup()
{
Serial.begin(9600);
Serial.println(".... remind user for serial input ....");
Serial.print("Compiler: ");
Serial.print(__VERSION__);
Serial.print(", Arduino IDE: ");
Serial.println(ARDUINO);
Serial.print("Created: ");
Serial.print(__TIME__);
Serial.print(", ");
Serial.println(__DATE__);
Serial.println(__FILE__);
//turn off L13
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Serial.println("Type something....");
} //setup
void loop()
{
if (Serial.available() > 0)
{
receivedChar = Serial.read();
Serial.print("You typed ");
Serial.println(receivedChar);
startTheClock = millis();
}
if (millis() - startTheClock >= interval)
{
Serial.println("Are you there?");
startTheClock = millis();
}
} //loop