The examples in serial input basics are simple reliable ways to receive data and there is a parse example that could be used to extract the words, if required.
If the data is being sent by a PC program (rather than a human operator) it would make your Arduino code much simpler if you reduce the commands to a single character such as 'H', 'T', 'D' etc
Thanks econjack & Robin2, Thanks for your time.. I totally got it.
My Progress: I Wrote a String compare function and calling It every time to compare, and returning no. of times It is call,To know the position. Works Great!
boolean myStrcmp(const char Str1[],const char Str2[])
{
byte z;
for(z=0;Str1[z]==Str2[z];z++)
if(Str1[z]=='\0')
return true; // if they are same
return false;
}
Now My doubt is, In My case, I am getting more than 25 Key-Words. Should I use the same Switch-statement method,or is there any other Optimal method ,If I want to scale it for more than 50(>50) words Like that.
How should I call Functions?, Please Help me in this:
Now My doubt is, In My case, I am getting more than 25 Key-Words. Should I use the same Switch-statement method,or is there any other Optimal method ,If I want to scale it for more than 50(>50) words Like that.
Now My doubt is, In My case, I am getting more than 25 Key-Words. Should I use the same Switch-statement method,or is there any other Optimal method ,If I want to scale it for more than 50(>50) words Like that.
Thanks in advance
Via a table of function pointers?
Up till no, I just used the Code mostly similar to #3 post. Using SwitchCase and returning back to main function and waiting for next serial Inupt.
Are you going to have a different function for each of 50 different words ?
Uptill Now, 16 Functions completed and...more to come...
Yep, Every Key-word, has its own function , Thats why I am asking , My Projects is, When a key-word is typed it should respond back with some data serially, ..Some thing similar to "terminal or cmd" over serial.
Hardware: Arduino Mega, Sd Card, RTC, Some Sensors
BhanuTejaJ:
My Projects is, When a key-word is typed it should respond back with some data serially,
I find it hard to visualize the purpose of this from your description and I have a suspicion that if we knew what you are really trying to achieve there is a much easier way.
Or maybe it is not really a project for which an Arduino is suitable / ideal.