Cesardaher (talk | contribs) No edit summary |
Cesardaher (talk | contribs) |
||
Line 76: | Line 76: | ||
===Commanding=== | ===Commanding=== | ||
The logic used to convert the tweets into commands is illustrated below. The existence or lack of each word in the tweet was checked in order to return a index-changing value. | |||
[[File:LEDcommand_flowchart.png]] | [[File:LEDcommand_flowchart.png]] | ||
As an example for the columns: | |||
<pre> | |||
int findDirHor (String check) { | |||
if (check.indexOf("left") != std::string::npos && check.indexOf("right") != std::string::npos) { | |||
Serial.println("left and right"); | |||
return 0;] | |||
} if (check.indexOf("right") != std::string::npos) { | |||
Serial.println("right"); | |||
return 1; | |||
} else if (check.indexOf("left") != std::string::npos) { | |||
Serial.println("left"); | |||
return -1; | |||
} | |||
Serial.println("nor left nor right"); | |||
return 0; | |||
} | |||
</pre> |