Sha256: 983bdcb89c07bf922e297539a6cdfa8d058be6500805b0771601100ea1095f7e
Contents?: true
Size: 647 Bytes
Versions: 11
Compression:
Stored size: 647 Bytes
Contents
#!/usr/bin/env ruby $:.unshift File.expand_path '../lib', File.dirname(__FILE__) require 'rubygems' require 'sinatra' require 'eventmachine' require 'arduino_firmata' # arduino = ArduinoFirmata.connect arduino = ArduinoFirmata.connect nil, :nonblock_io => true, :eventmachine => true get '/' do redirect './on' end get '/on' do analog = arduino.analog_read(0) arduino.digital_write 13, ArduinoFirmata::HIGH "<p>analog : #{analog}</p><p><a href='./off'>LED OFF</a></p>" end get '/off' do analog = arduino.analog_read(0) arduino.digital_write 13, ArduinoFirmata::LOW "<p>analog : #{analog}</p><p><a href='./on'>LED ON</a></p>" end
Version data entries
11 entries across 11 versions & 1 rubygems