Introduction: Arduino for Beginners: API's and Checking Local Weather Via WIFI
In this video we will use an Arduino Yun (or leonardo with a wifi shield) to connect with the Yahoo Weather API and return the value of the local temperature (whatever location you want!) as an integer to be used in whatever project you can dream up. We will go through a service called Temboo that makes communicating with many API's very easy.
You will need:
- Arduino Yun or an Arduino Leonardo and a WIFI Shield (BOTH will be considered a "YUN" board in the Arduino IDE).
- A USB cable.
- A 9V Battery
-and a 9V battery pack with barrel plug to power the Arduino Board and an on/off switch.
Links to all parts can be found here:
Step 1: Get Connected to Your Network.
Step 2: Sign Up for a Temboo Account and Get Your Credentials.
Sign up for a Temboo Account and navigate to the "APPLICATIONS" section to get your
- Temboo account name
-App key name
-and App key
Step 3: Create a New Sketch and Upload Some Code:
Create a new sketch, copy the main code and paste it into the IDE
(I will also upload the whole thing as a .zip file here).
Click the down arrow underneath the magnifying glass icon, and hit new tab.
Call the new tab "TembooAccount.h" (without the quotes)
Copy and paste in the smaller code snippet (that was below the larger one) and save it.
Step 4: Upload the Code and See the Local Weather!
-Click the TembooAccount.h file and enter in all your Temboo credientials from the "applications" section of your account.
-Go to the main program and find this line:
String ADDRESS_FOR_FORECAST = "*****"; //Enter zipcode for where you want to check the weather.....
-Inside the quotes enter your desired "zipcode" or "city, state"
-Plug in your board via USB and power it with the 9V battery pack.
-Hit tools, board, and choose Arduino YUN board. Hit port, and select the USB port that your board is on.
-Upload the code and open the serial monitor. You should now be displaying the local temperature for your desired location as an integer.
-Towards the bottom of the main program you can see that this integer gets stored in a variable called "temp"
I left some space there below it so you can incorporate this into your next project and have it perform actions based on the value of the temperature being returned.
We have a be nice policy.
Please be positive and constructive.