Sha256: 123ddebf51c49dc7449222ae97c6550d98e139723b3273097a8419e044211b97

Contents?: true

Size: 380 Bytes

Versions: 7

Compression:

Stored size: 380 Bytes

Contents

#!/usr/bin/env ruby
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
require 'rubygems'
require 'arduino_firmata'

arduino = ArduinoFirmata.connect ARGV.shift

arduino.pin_mode 2, ArduinoFirmata::INPUT

loop do
  if arduino.digital_read 2
    puts "on"
    arduino.digital_write 13, true
  else
    puts "off"
    arduino.digital_write 13, false
  end
  sleep 0.1
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arduino_firmata-0.3.7 samples/digital_read.rb
arduino_firmata-0.3.6 samples/digital_read.rb
arduino_firmata-0.3.5 samples/digital_read.rb
arduino_firmata-0.3.4 samples/digital_read.rb
arduino_firmata-0.3.3 samples/digital_read.rb
arduino_firmata-0.3.2 samples/digital_read.rb
arduino_firmata-0.3.1 samples/digital_read.rb