Go Down

Topic: how to interpret the serial data (Read 2 times) previous topic - next topic

latee

Mar 14, 2013, 09:44 am Last Edit: Mar 14, 2013, 10:10 am by nehj Reason: 1
can u please give me a sample that are receiving a serial data,that f the mcu receive a charater 'a' the corresponding data will store in a buffer and when the character 'b' is detected d corresponding character will store to other buffer..can u please give me a related sample

AWOL

Code: [Select]
if (Serial.available ()) {
  int inChar = Serial.read ();
  switch (inChar) {
    case 'a': // do something
    break;
    case 'b': // do something else
    break;
   default: // do something completely else
  }
}
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

AWOL

The code I gave you is just an incomplete example - you need to fill in the blanks, or you could rewrite as, say, a simple state machine.
You original question wasn't specific.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

latee

ah...i know that it is incomplete i just want to know if it is applicable to what i want to do?tnx

PaulS

Quote
the char 0999999999 will be save to a buffer

Which ONE key did you press to type the character 0999999999?

Go Up