Sha256: bbcaa9345dc525f2af5482e53c0e1fd9d6ba7ec0e445dac462626fba6f8740f7

Contents?: true

Size: 436 Bytes

Versions: 2

Compression:

Stored size: 436 Bytes

Contents

#!/usr/bin/ruby
require "lignite"

dc = Lignite::DirectCommands.new

# see 28/31 of Comm dev kit, read light sensor value on port 3
LAYER0 = 0
MODE = 0
pct = dc.with_reply do
  # global vars
  dataf :light

  # TODO: make the block optional if there are no locals. or #with_locals
  block do
    input_device_ready_si(LAYER0, Lignite::PORT_3, Lignite::TYPE_KEEP, MODE, :light)
  end
end
puts "Light sensor percentage: #{pct}"

dc.close

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lignite-0.6.0 examples/light-sensor.rb
lignite-0.5.0 examples/light-sensor.rb