Sunday, May 20, 2012

Week 3: Framework Code Completed

This week has been mighty productive.  I've managed to gain a further understanding of the code I'd be needing to run this project, and I've gotten it fully working (to my knowledge), and implemented!  Although I can't fully test the code at this point, I've already begun looking into how to set up a local server which is capable of running PHP so that I'll be able to finish up some PHP scripts for next week.  Once I'm able to run my PHP scripts, I should be able to test the code I've written this week to see if it actually pings my GMail account correctly.  Right now, it works like this:

- I have two LED's on my board.  One will light up each time I ping the server, which is based upon my delay time set of five seconds.  Essentially, every five seconds, I will call upon my PHP script and obtain the result.

- The script called will gather the total amount of emails in my inbox, as that is all I truly know how to do at this point.

- That integer value will be stored as 'num' in my code.

- I will then test to see if the PREVIOUS number I got (on the last GMail ping) is higher or lower than my current number, and then set the current number to prevNum.

- If the new number is higher, I turn on the other LED to indicate a new EMail in the inbox.  If the count goes down, I'll turn the light off.

Viola!


However, I do spot a problem with this.  The only way to turn my light off will be by deleting an email.  What if I receive an important email?  I may not want to necessarily delete it.  Well, I've recently found a PHP script which the owner claims, with a little modification towards your own setup, will gather only the count of emails with a "U" flag on them, or an unread flag.  This would be useful, as I could turn my light off after simply opening the email rather than having to delete it.  I would also only have to keep track of one integer pulled from the script, rather than two.  I'll be looking into this this week, and should have a fully-working example next week!

No comments:

Post a Comment