Go Down

Topic: Home automation using Twitter, Ethernet Shield (W5100), and Apache2 - PHP (Read 3 times) previous topic - next topic

zoomkat

Quote
Arduino 'String's can only contain so much data, I forget what the byte limit is, however it isn't enough to store a full-fledged website.


I've got a 4 GB SD card in my Ethernet shield, which can hold a fair amount of html stuff.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

Jesterbaze

Quote

I've got a 4 GB SD card in my Ethernet shield, which can hold a fair amount of html stuff.


I like where you're going with that idea, I do have an SD card slot in my W5100 Ethernet shield. The problem I'm hitting more specifically is the part in my code where the website data is read

Code: [Select]

//Under the readPage() function

      while (client.available())
      {
        char c = client.read();
        webData += c;
      }


webData only retains so much information, and I'm not really sure of a good way to store more data in that string, or even a good elegant way to use a String[] array...

Ihatehandles


Continued:
Next time you text "::on::" Twitter will respond and say something to the effect of "You've already posted that!"

Since your program is only reading the data between your two designated markings, next time you text Twitter, just text:
Code: [Select]

"::on::2"
"::off::2"
"::on::3"
"::off::3"  and so on.

or append your command in some other creative way.  Your program will still only read "on", but Twitter is happy because you aren't just reposting "::on::" and "::off::".

Please feel free to modify this code, or offer some creative solutions to some of these issues if you have any ideas!  I would love to see this project grow!

I had similar problems with Twitter... Couldn't you just create two strings from the read in tweet, using one and make the other junk... So if the tweet could be manually incremented "ON1, ON2, ON3" while the string from the read function only took the first two characters and junked the rest.... Then the logic for your output command could remain the same and only look for the "ON" message.

I hope this helps

Jesterbaze

Quote

I had similar problems with Twitter... Couldn't you just create two strings from the read in tweet, using one and make the other junk... So if the tweet could be manually incremented "ON1, ON2, ON3" while the string from the read function only took the first two characters and junked the rest.... Then the logic for your output command could remain the same and only look for the "ON" message.

I hope this helps


2 strings from the read in tweet? Like, where the code sorts out the Tweets from the HTML it pulls?

Oh or like, have a starter marker, without a finish marker. So it doesn't pull only whats between the two '::" marks?? I think I see what you mean now... So I don't have to type '::' at the end of my command, and my program will still read what I'm saying. That actually works pretty well. Only issue is if I want to add other commands to my code instead of just ::ON:: and ::OFF:: . But actually for what I'm using it for right now, that would be perfect! Thanks man!

Not sure if this is related, but I really wish this code could take the standard HTML headers and everything and delete them from the memory. Like a 24 char read-in buffer. Pull 24 chars of the HTML, decide if it's the command or not, then scrap them. This way I could pull pages of HTML code from my site, instead of just having a small Apache PHP page. IE: Make a website instead of a lame page with the latest 3 tweets from my account... I know this can be done, but I haven't messed around with using bits/bytes of data yet in my code. Anyone have any ideas how to do that?

In short to the idea above:
-I need a buffer to read 'x' amount of chars from the website. Lets say 24.
-Place the 24 chars in a temp string, and decide if it's a command or not.
-If yes - run the command
-If no - scrap the 24 chars from the memory. (Replace the string as " " or something??? IDK if that would clear the memory or add a space char to the code every 24 'junk chars'.)
-Ultimately, I want this to allow for MUCH more capacity to read entire websites for command strings, instead of tiny little webpages.

Lets get some ideas rolling =) I think this could be a badass little project  XD

farsi

indeed interesting project - I was thinking on observing some news on a website and display this news in a physical form via an Arduino. Your project might be a good start.

I was wondering about the Ethernet setup - what exactly are the options? It might be possible to take an Arduino Yun and run the Twitter client from there?

What about a wifi setup?

Go Up