Sha256: 444028b34b2f0982d8c11d27f4d0f62dc6b7b9eec2f4dba6833081b0aa3504aa

Contents?: true

Size: 443 Bytes

Versions: 1

Compression:

Stored size: 443 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}"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lignite-0.2.0 examples/light-sensor.rb