First of all, I need to say that I was fully inspired by this blogpost, I liked so much that project, that I decided to fork this project and use Ruby (Arduino) instead of Python and Triggerino.
A little bit of history
One of the things I’m passionated about is the DIY philosophy, when I was young I used to spend my time doing experiments with electronics, but then I grew up and I replaced that passion with programming.
In the past RubyConf there was a talk from Austin Vance that involved Ruby and Arduino, I must say that was very interesting, that talk woke up my passion with electronics, and the best of all, it mixes both passions.
That day at the end of the conferences, I went to the closest Radioshack® and I bought my Arduino starter kit, and since then I’ve been experimenting with my Arduino and Ruby, with the time those experiments became Triggerino.
What is Triggerino?
The main idea of this is to have a box with a big red button, and have the ability of run tasks from my ruby project pushing that button. Cool, isn’t it?
What can I do with Triggerino?
- Run your test suite
- Deploy your project
- Run rake tasks
- Run whatever you want
Add these lines to your application’s Gemfile:
gem 'triggerino' gem 'dino', git://github.com/supherman/dino.git', branch: 'lcdv3'
And then execute:
- Create a “triggerino” dir
- Define your action classes
touch triggerino/my_action.rb class MyAction include Triggerino::Action def perform # puts your action logic here end def to_s 'A descriptive name for your action' end end
- Wire your arduino like this:
Also add 2 push buttons: one will be the action selector and it needs to be connected to the pin 10, and a the other one will be the trigger and it needs to be connected to the pin 9.
- Run the listener
bundle exec triggerino
Need to know more about Arduino and Ruby?
Keep and eye on the dino gem, people started to contribute on the project and they are doing amazing things that will make work with Arduino and Ruby easier.
And If you like robots and electronic stuff, you’ll want to take a look at Artoo, a framework that will help you build robots with Ruby, it has support for Arduino, Parrot AR Drone 2.0, Sphero and Roomba.
Also, if you are a dev with an itch to learn more about this kind of topics, I think you should go to MagmaConf, there will be 2 talks about electronics and Ruby; so it will be a good chance to learn something new.
And that’s it for now, hope you find this useful and interesting. 😉
Thanks for reading.