In this exercise, we will connect button to “tweet” to a shared Twitter account. Each group will have a button that, when pressed, will tweet: “Hello Twitter World, from Team X! Tweet 1. #CTCYourCity”
Think of a really fun team name and let’s get started!
The shared Twitter account is: https://twitter.com/CTC_IoT
Refer to CTC IoT Teacher Guide #2.
Materials:
- 1 Arduino YUN
- 3 jumper wires
- 1 10k resistor (The colors on it are brown, black and gold)
- 1 Push button
- 1 bread board
Assembling the MDF parts
-
Tape RGB LED under top piece and insert the button.
-
Assemble sides
-
Attach wires to button and assemble last side
You can find the code in File -> Examples -> BasicEducationShield-> IoT -> e1_twitter
Modifying the code
- Open “e1_twitter” from the examples
- In the sketch, modify twitterMessage and customize the following text for your team: “Hello Twitter World, from Team X!”
- Change the hashtag to match the city where you are now (ex: #CTCLondon).
- 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.
Twitter will not allow duplicate tweets within a given time period, so the program includes an increment (“Tweet1”, “Tweet2” … “Tweet14”). It also places a limit 1 tweet every 10 seconds. If the tweet does not appear because it is a duplicate, try changing twitterMessage to something new.
Twitter hashtag search link: https://twitter.com/search?q=%23CHANGETHIS HASHTAG&src=tyah