You will use the same electronics setup as the previous exercise. However, we will change the program so that it calls up the Arduino Temperature API.
We’ll tweet “It’s X degrees in X city! Tweet 1. #CTCYourCity” it to the common Twitter account.
Material:
- Arduino YUN
- 5st jumper wires
- 2st 10k resistors (The colors on them are brown , black, orange and gold)
- One push button
- One LED
- Breadboard
The next few steps are the same as the previous exercise. If you still have it built, then jump to step 2.
Modifying the code
- Construct the MDF parts to hold the button and RGB LED.
- Open “e2_temperature_twitter” from the examples.
- In the sketch, modify cityName to the city and countryCode to the country code.
- Change the hashtag to match the city where you are now (ex: #CTCLondon), not the city you are checking the temperature of.
- Make sure the button and LED are connected to the correct pins.
- Upload the sketch to the Yún.
- When the onboard LED L13 is on, the Yún is ready.
- Open the Serial Monitor and press the push button.
- When you see “Tweet sent” , go and check Twitter for your message. The shared Twitter account is:
As before if you wish to send more tweets, you need to change the content of the message first.