Step 6: Customizing It: Umbrella Alarm

After thinking about all the useful information that's sitting on the Internet, I re-wrote Rudolph to also grab data from web pages.  You can get the code here.

Here's how to use it to grab a weather forecast off the Internet and remind you when to grab an umbrella;

1.  Find the web page that has the data you want
Small pages work best.  For weather forecasts, I surfed around the NOAA site and found this page.  This is what I entered;

Start the networking with: startnetworking(@servername, @uri, @IP, port)

2.  Identify the data you want to use
On that page, the data element <pop> is the probability of precipitation for my area.  For my Umbrella Alarm, I don't need the whole page - just the value stored in the pair of <pop> tags.  The addfield method is how you identify what parts of the page you want to use in your project.  Grab the data between the first pair of <pop> tags with the line;

The first argument, string("pop"), tells the program that we're looking for data within the <pop> tag.  The second argument, @rain, tells the program where the data it finds should be stored.  The search always stops when it finds the first tag that matches the criteria.

3.  Grab the web page!
Now we know what web page our data is stored on, what data we want to retrieve, and where to store the result.  serverrefresh grabs the page and updates the values.  Each time we call it, a request is sent to the remote server and the local values are updated with whatever the server returns.

Keep in mind the result is always returned as a text string.  If the result should be a number (like the probability of rain),  the str2dec method will convert it to a number for you.

This umbrella alarm grabs a web page that includes a weather forecast, parses it and returns the probability of rain.  If the probability of rain is greater than 30%, our red LED turns on.  Here's the complete program;

around the turn of the century (circa 2000) I could call yahoo and hear my emails read to me.
My kid has a leapFrog talking dog my pal Scout and I would love to modify it to speak in spanish. would something like this work?
How large do you want the vocabulary to be? If it's not too many words, you can record the language samples onto an SD card and play them back - the <a href="https://www.instructables.com/id/Toilet-Buddy/" rel="nofollow">Toilet Buddy</a> Instructable would get you started.<br> <br> For generating Text-to-speech, this might work, but it would be pretty rough sounding.
I am trying to make an app to check for new stuff on our classifieds. Could you help me with that?<br><br><br>

About This Instructable



More by Gadget Gangster:Hack Your Car Talking Resistor Calculator Bananaphone: A Touch Capacitance Synth 
Add instructable to: