Last friday I had a change to fool around with a Spark Core at Fablab Breda during the Instructables Build Night of November.
I already managed to read Tweets with my Spark Core, so the next step was to send tweets with my Spark Core!
I tried some different codes and eventually found the Kid-Summoner. After some slight modifications the code worked. I then tried to Tweet something different depending on which button is pressed.
In this Instructable I will explain how to set everything up so that you can Tweet different content depending on which button is pressed.
I'm going to assume you've already set up your Spark Core. If you haven't, please check out my Read-a-Tweet Instructable where I explain how to set up your Spark Core. You can also check out the Spark Docs.
This is what you're going to need for this Instructable:
Step 1: PushingBox
We're going to use PushingBox to handle the tweeting. So go to www.pushingbox.com and click the Login with Google button at the right top.
Then click the My Services button in the menu at the top. Click Add a service, choose Twitter, and follow the instructions.
Next click My Scenarios in the menu at the top. Type a name for your scenario in the input field (see the arrow on the second image). We're going to make two scenarios for this Instructable. I called my first scenario Send-a-Tweet-1 and the second one Send-a-Tweet-2.
After you pushed the Add button, it will automatically open the page of your scenario. On this page we're going to define the Tweet. Click the Add an Action button and then choose Twitter. Type your Tweet in the pop-up (see third image).
Repeat this for the second scenario.
Step 2: The code
Next step is the code.
You only have to change a tiny thing in the code.
As stated in the previous step, each scenario has its own DeviceID. When you look at the code, you will see DEVICE_ID1 on line 13 and DEVICE_ID2 on line 14 (see image). You need to change those to the DeviceID's of your scenarios.
After you've done that you can flash the code to your Spark Core. You can do this by simply clicking the lightning bolt icon in the upper left corner. It'll then flash the code to your Spark Core.
The code could be a bit better. Especially the loop. I unfortunately didn't have time to rewrite the code and test it on a Spark Core. The code provided works, it could just be a bit neater and tweaked better.
Step 3: You're done!
Once you flashed the code to your Spark Core, you should be able to send different tweets depending on which button you push. It might take a second for Twitter to load your Tweet.
Feel free to modify the code so it fits your needs. Or maybe try to connect your Twitter to IFTTT (or another service)
You can also check out my Read-a-Tweet Instructable if you want.
Let me know in the comments what kind of cool stuff you build! :)