Introduction: Tweeting From MKR1000
This post should allow you to tweet a message from an MKR1000.
I spent today searching the web for a way to tweet from an Arduino MKR1000. I found several websites but couldn't find an overall simple method of doing this. Eventually I think I figured it out by mashing together a few websites advice.
I suppose the main source of information I found useful was This Post using a Wifi shield. However, When I copied the .cpp and .h files into the library, the sketch wouldn't compile for the MKR1000.
Finally, I found out that a small amendment to the .h file makes it work fine.
Step 1: Plug in and Test Your MKR1000
Plug your MKR1000 into the computer. Open the Arduino IDE and go to sketch>include library>manage libraries. When the dialogue box pops up, search for Wifi101 and install it. Do exactly the same routine to install the Arduino Twitter Library.
You can now test your MKR1000 is working by uploading the ConnectWithWPA or ScanNetworks examples in the WiF101 Library.
Once you have done that, go to the libraries folder in the Windows Arduino folder and replace the Twitter.cpp and Twitter.h files with the ones below.
These are copies from the previously mentioned website, but with a small change.
I have changed the #include to #includein the Twitter.h. This should fix the compile error for MKR1000.
Step 2: Getting the Twitter Token.
Go Here and follow step 1. you will need to have a twitter account to start with, or to have set one up for your application. you can basically ignore step 2 ,because we already did that. and step 3 is to run the code. which you could do or you could run the one I made. that up to you.
Copy the twitter token into the code a. away you go.
Step 3: My Code to Tweet
I have included my code because it is slightly different from the the other post. I cobbled it together from the ConnectWithWPA example, in the Wifi101 library, and added a couple of sections from the SimplePost Example, in the Arduino Twitter Library. (See Picture highlighted).
The final code listing is also given in the file.
Step 4: CONCLUSION
Overall it seems to work well. I am now going to try to get tweets as reactions from input sensors. That should be a fun Sunday.
Thanks all, and happy tweeting.
We have a be nice policy.
Please be positive and constructive.