Sha256: a63d7b89bd5a6443afcd9e8a0c72ad96628a3b12bd43f0938e72fd89cef188f2

Contents?: true

Size: 417 Bytes

Versions: 7

Compression:

Stored size: 417 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.on :analog_read do |pin, value|
  if pin == 0
    puts "analog pin #{pin} changed #{value}"
    arduino.analog_write 11, value
  end
end

led_stat = false
loop do
  arduino.digital_write 13, led_stat
  led_stat = !led_stat
  sleep 1
end

Version data entries

7 entries across 7 versions & 1 rubygems

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