Sha256: 54c58cfafadd3dd4da6b830a6792c4c9db06a350e575138eb0a150438de40087

Contents?: true

Size: 453 Bytes

Versions: 2

Compression:

Stored size: 453 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
count = 1
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, count, :light)
  end
end
puts "Light sensor percentage: #{pct}"

dc.close

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lignite-0.4.0 examples/light-sensor.rb
lignite-0.3.0 examples/light-sensor.rb