This project is my 1st foray into the world of spark core. I wanted to get some hands on experience with spark core, sensors and electronics in Spark maker kit, its cloud IDE & the "cloud OS" . I also wanted introduce my 8 yr old kid to the exciting world of electronics and programming. She named it "like-anator" spontaneously as she is a "Phineas and Ferb" fan.
This project has 3 main parts
1) the bread-board & electronics ( all the components seen in the pic came in the spark maker kit that I bought here www.spark.io)
I connected the +ve end of buzzer directly to pin D5 on the core, -ve to the GND on the core. The core is powered by USB hub .
2) a program that monitors Facebook "likes"
I wrote this program in Java and runs in a forever loop on my macbook. The only job of this program is to monitor facebook likes on a particular page and if they increment, invoke a function "buzz" on spark core using spark's REST API.
replace XXXXX in the code with the Facebook page you want to monitor. your spark device ID and spark token also need to be added to make the REST call to your spark.
alert: this program is a hack with a lot of things which are less that perfect. The likes are parsed assuming a specific position of the likes number in the text response from Facebook. you may have to fine tune this pgm for your case.
3) firmware on spark to generate beeps when a method/function is invoked.
If you are totally new to spark, I would recommend playing with some spark examples first from their website, to get hang of REST API, the cloud IDE etc. goto http://docs.spark.io/examples/
I could have written the spark firmware so that it would run the entire logic of checking Facebook likes also, however I chose to write the "Java Server" as in step 2 seperatly coz if this was a real commercial project, i would have done it this way to keep firmware as simple as possible and load the micro controller as less as possible.
Comments