Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int count = 0; // count = 0
- char userInput[5];
- void setup()
- {
- delay(1000);
- Serial.begin(19200); // begin serial port with baud rate 9600bps
- }
- void loop()
- {
- if (Serial.available() > 5)
- {
- Serial.read();
- }
- else if (Serial.available() < 4)
- {
- Serial.read();
- }
- else if (Serial.available() == 5)
- {
- for (int i = 0; i < 5; i++)
- {
- userInput[i] = Serial.read();
- }
- Serial.print("User Input - ");
- Serial.println(userInput);
- }
- delayMicroseconds(10000);
- }
- abcde
- abcd
- abcd
- abcd
- abcd
- abcdef
- abcde
- User Input - abcde
- User Input - dabcd
- User Input - dacbd
- User Input - bcdef
- User Input - abcde
Add Comment
Please, Sign In to add comment