IFD:Designing Networked Objects/César Felipe Daher: Difference between revisions

From Medien Wiki
No edit summary
Line 44: Line 44:


*Search for a keyword
*Search for a keyword
<code>std::string search_str;
<pre>std::string search_str;
 
String tmsg = tcr.searchTwitter(search_str);</pre>
String tmsg = tcr.searchTwitter(search_str);</code>
*Retrieve user information
*Retrieve user information
<code>std::string search_str;
<pre>std::string search_str;
 
tcr.searchUser(search_str);</pre>
tcr.searchUser(search_str);</code>
*Post to Twitter
*Post to Twitter
<code>std::string twitter_post_msg;
<pre>std::string twitter_post_msg;
 
tcr.tweet(twitter_post_msg);</pre>
tcr.tweet(twitter_post_msg);</code>




Line 61: Line 58:
Once I understood how to properly use this library and had successful attempts, I moved on to develop a more complex mechanism. Inspired by the previously mentioned Twitch Plays Pokémon, I devised a device which would collect tweets with any one of the directional words "up", "down", "left" and "right" (excluding retweets, in order to prevent duplicates) and use them as commands for the microcontroller. The interesting thing about these words is that they are extensively used in the English language with other conotations, which makes the search especially random.  
Once I understood how to properly use this library and had successful attempts, I moved on to develop a more complex mechanism. Inspired by the previously mentioned Twitch Plays Pokémon, I devised a device which would collect tweets with any one of the directional words "up", "down", "left" and "right" (excluding retweets, in order to prevent duplicates) and use them as commands for the microcontroller. The interesting thing about these words is that they are extensively used in the English language with other conotations, which makes the search especially random.  


<code>std::string search_str = "up OR down OR left OR right -RT";</code>
<pre>std::string search_str = "up OR down OR left OR right -RT";</pre>


===LED matrix===
===LED matrix===
Line 68: Line 65:
[[File:LED_array.png|200px]]
[[File:LED_array.png|200px]]


<code>
<pre>
const int rows = 3;
const int rows = 3;
const int columns = 3;
const int columns = 3;
uint8_t pinVal[rows][columns] = { { D0, D1, D2 }, { D3, D4, D5 }, { D6, D7, D8 } };
uint8_t pinVal[rows][columns] = { { D0, D1, D2 }, { D3, D4, D5 }, { D6, D7, D8 } };
</code>
</pre>
   
   
In order to light them up:
In order to light them up:


<code>digitalWrite(pinVal[a][b], HIGH);</code>
<pre>digitalWrite(pinVal[a][b], HIGH);</pre>


===Commanding===
===Commanding===


[[File:LEDcommand_flowchart.png]]
[[File:LEDcommand_flowchart.png]]