I am trying to make program which can execute one instruction continuous on one serial command and and after receive another command at any time starts executing other instruction.
I need this program for five different serial commands namely a,b,c,d,e,
note that, command can be anytime interrupt program and according to command the instruction should be executed until not receive another command.
Please help.
I made it for 2 command but i don't know why it not running. it executes only on 2nd command.
first command executed
Please read up HOW TO POST YOUR CODE
I can’t see it here on my tablet, because it’s noy inline with </> code tags
Edit the original in this case and we can take a look.
if(data=='a')
{
Serial.println("omkar");
delay(200);
Serial.println(data);
data='a';// the only reason you got here is because data already has the value 'a'.
}
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Are you saying that even if you send 'a' the code for 'b' is run?
Maybe you would have more success if you listened to people here and answered some of their questions.
You obviously have not yet helped with very many questions here or you would realize how often the symptoms are described in a very fuzzy way. All you needed to say in Reply was "yes". Have you carefully studied the link I gave you?
Apologies to everyone. Please ignore the above.
I had mistakenly thought that @BJHenry was the OP for this Thread. (Senior Moment)