Ruby powered robots.
- Download and install the Arduio IDE for your OS
- Download and unzip Firmata 2.2
- Plug in your Arduino via USB
- Open the Arduino IDE, select: File > Open > [Path from step 2] > examples > StandardFirmata
| Using rake (10.0.3) | |
| Installing i18n (0.6.4) | |
| Installing minitest (4.6.2) | |
| Installing multi_json (1.6.1) | |
| Installing atomic (1.0.1) | |
| Installing thread_safe (0.1.0) | |
| Installing tzinfo (0.3.36) | |
| Installing activesupport (4.0.0.beta1) | |
| Installing builder (3.1.4) | |
| Installing erubis (2.7.0) |
| # coding: utf-8 | |
| require 'sinatra' | |
| set server: 'thin', connections: [] | |
| get '/' do | |
| halt erb(:login) unless params[:user] | |
| erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
| end | |
| get '/stream', provides: 'text/event-stream' do |
Ruby powered robots.
| # We only care about Tick and Alarm events. | |
| # The Alarm event should only be handled once. | |
| # All other events should be ignored. | |
| require 'observer' | |
| class Clock | |
| include Observable | |
| def tick |
What is Arduino?
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
| MyApp::Application.routes.draw do | |
| # we only need index and show | |
| resources :posts, :only => [:index, :show] | |
| # we need everything but destroy | |
| resources :widgets, :except => [:destroy] | |
| end |
| class Ninja | |
| def initialize(name, &block) | |
| @name = name | |
| @move = block | |
| end | |
| def attack | |
| @move.call | |
| end | |
| end |
| /Users/hardbap/.rvm/gems/ruby-1.9.2-p290@thumb/gems/activesupport-3.2.5/lib/active_support/core_ext/class/attribute.rb:75:in `accessible_attributes': wrong number of arguments (1 for 0) (ArgumentError) | |
| from /Users/hardbap/.rvm/gems/ruby-1.9.2-p290@thumb/gems/actionpack-3.2.5/lib/action_controller/metal/params_wrapper.rb:171:in `_set_wrapper_defaults' | |
| from /Users/hardbap/.rvm/gems/ruby-1.9.2-p290@thumb/gems/actionpack-3.2.5/lib/action_controller/metal/params_wrapper.rb:133:in `inherited' | |
| from /Users/hardbap/.rvm/gems/ruby-1.9.2-p290@thumb/gems/actionpack-3.2.5/lib/abstract_controller/railties/routes_helpers.rb:7:in `block (2 levels) in with' | |
| from /Users/hardbap/.rvm/gems/ruby-1.9.2-p290@thumb/gems/actionpack-3.2.5/lib/action_controller/railties/paths.rb:7:in `block (2 levels) in with' | |
| from /Users/hardbap/code/opinionaided/thumb/app/controllers/pages_controller.rb:1:in `<top (required)>' | |
| from /Users/hardbap/.rvm/gems/ruby-1.9.2-p290@thumb/gems/activesupport-3.2.5/ |
| <!--[if IE]> | |
| <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> | |
| <![endif]--> | |
| <!--[if !IE]>--> | |
| <script src="/assets/zepto.min.js?body=1" type="text/javascript"></script> | |
| <!--<![endif]--> |
| // Dimensions of devices | |
| // iPad Retina - 1536x2048 | |
| // iPad - 768x1024 | |
| // iPhone - 320x480 | |
| // iPhone Retina - 640x960 | |
| @mixin mobile-only { | |
| @media only screen and (max-width : 480px) { | |
| @content; | |
| } |