This year for our Kscope (ODTUG) session Jake and I decided to make things a bit more exciting and show a fun way to use OSN REST API. The attendees played Rock’em Sock’em Robots using their phones.
At the end of our session the attendees were given a phone number to text or call to select which robot they wanted to start giving punches. Immediately after they called or texted they got a text message back telling them which of the seven box combination the robot they choose was going to deliver (Jab-Right Cross, Jab-Jab-Cross, Jab-Cross-Left hook, Jab-Cross-Hook-Cross, Jab-Cross-Left uppercut-Cross, Jab-Right uppercut-Left hook-Right hand, Right cross-Left hook-Right cross). If the robot they choose knocked the head off the opponent robot, they received a text message indicating their robot they choose won. It asked them to show the text message to us to receive a prize (our popular Oracle branded Flying-Screaming Monkeys). Meanwhile on the projector screen an OSN conversation kept track of all the action.
- Call or text received by Twilio.
- Twilio sends call or text data as a POST to a remote server with a custom PHP script.
- Script selects a random box combination.
- Script insert request to APEX based DB queue in form of a REST call.
- Script makes a call to APEX DB custom REST service and loops for each request.
- Script inserts to OSN by making a POST to OSN Public API.
- Script sends SMS to Rockem Sockem Robots.
- The Rock’em Sock’em robots Arduino with GSM module receives SMS and executes the request combo.
- If a robot head sensor detected that it had been knocked, the Arduino GSM module sends an SMS to another PHP script that updated OSN and sends text message to all the winners.
The whole build took me a couple weeks to build. It is important to note that this was not the first Rock’em Sock’em implementation out there. I actually borrowed most of the build design from a team at TI (http://processors.wiki.ti.com/index.php/Electronic_Rock-Em_Sock-Em_Robots).
This was a very fun experience and of course this doesn’t show an immediate business case for the use of OSN. Nevertheless it provided a great way to invite developers to be creative and get to know the API capabilities.
Check out the video:
P.S. I might be able to do an Instructable post in the future if anyone is really interested