The littleBits cloud starter kit consists of 5 modules cloud bits, sound trigger, long led, button,servo and USB power. The main heart of this kit is cloud bits which have onboard wifi adapter which will connect the device to the internet. When the kit is connected to the internet, we can able to collect and post information to the device using the littleBits cloud API.
1. Setup littleBits device
Once you purchased the littleBits cloud starter kit, you can able to connect the device by following the steps given in the link control.littlebitscloud.cc or you can download the littleBits mobile application to connect your device to the internet. Build the device module as shown in the below picture
2. Connecting littleBits and Salesforce
The next step is to collecting the data from the electronic devices and write it in salesforce. To make the connection easy I have created a public web service REST class to connect with salesforce. Create the following web service class in your org
Now we have created the custom apex REST web service class in salesforce and to make this web service class public. You have to create force.com site and assign this apex class to that force.com site guest user profile. Check this link for more detail http://forceguru.blogspot.ca/2012/09/creating-public-web-service-in.html
Now you will have the public web service URL something like below
3. Subscribe to the device event
Whenever there is an event occurs in the device its has to send the data to our web service to create that information in salesforce. Using the littleBits cloud API we can subscribe to the device event using our public web service URL. Run the below code in the execute anonymous window in your developer org, this is the one-time activity
All setup process are completed and now we are ready to send the information from the device to salesforce. When you are going to press the button in the kit it will insert a new record in salesforce.
The blog post from Salesforce MVP Andrew Fawcett helped me to lot understand more about the device and made this experiment possible - https://andyinthecloud.com/2015/01/02/introducing-the-littlebits-connector-for-salesforce/