Kaustubh Agarwal
Published © GPL3+

Twitter Weather Station

A twitter page that informs you about the temperature of your area on a hourly basis. It also tweets whenever there is a drastic change.

IntermediateShowcase (no instructions)1 hour1,436
Twitter Weather Station

Things used in this project

Software apps and online services

ThingSpeak API
ThingSpeak API
MATLAB
MATLAB

Story

Read more

Code

Weather Tweet Station

MATLAB
% Scrape a website to identify the current temperature in Natick. The
% temperature is then written to another ThingSpeak channel.

% Specify the url containing information on Boston Harbor traffic. I am using this Indian website. 

url1 = 'http://www.timeanddate.com/weather/india/greater-noida';

% TODO - Replace the [] with channel ID to write data to:
writeChannelID = [];

% TODO - Enter the Write API Key between the '' below:
writeAPIKey = '';

% Fetch data and parse it to find information of interest. Learn more about
% the URLFILTER function by going to the Documentation tab on the right
% side pane of this page.
tempF = urlfilter(url1, '<div class=h2>');

tempC = (5/9)*(tempF-32);
temp = 0; 

display(tempC, 'Temperature in Noida');

% Write the temperature data to another channel specified by the
% 'writeChannelID' variable

display(['Note: To successfully write data to another channel, ',...
    'assign the write channel ID and API Key to ''writeChannelID'' and ',...
    '''writeAPIKey'' variables above. Also uncomment the line of code ',...
    'containing ''thingSpeakWrite'' (remove ''%'' sign at the beginning of the line.)'])

% Learn more about the THINGSPEAKWRITE function by going to the Documentation tab on
% the right side pane of this page.

 thingSpeakWrite(writeChannelID, tempC, 'Writekey', writeAPIKey);
 

Credits

Kaustubh Agarwal

Kaustubh Agarwal

14 projects • 191 followers
IoT Enthusiast SDE@ASML

Comments