Sha256: a7ed77e184e1dcded3cd76b39fcfbda36e2ec1c5c5c04754e2457eb9d342d263

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/lib')

require 'green_eye_monitor/client'

require 'slop'
require 'awesome_print'

opts = Slop.parse do |o|
  o.bool '-d', '--debug', 'enable debug mode'
  o.on '--version', 'print the version' do
    puts Slop::VERSION
    exit
  end
end

client = GreenEyeMonitor::Client.new(:baud => 115_200, :debug => opts[:debug])

# client.packet_format = :bin48_net_time
# client.enable_realtime

# exit

puts '# Direct'
puts "Serial: #{client.serial}"
puts "Hertz: #{client.hertz}"
puts "Temp: #{client.temperature(1)}"
# puts "Recent: #{client.recent_values}"
puts

puts '# List Format'
client.packet_format = :list
puts client.send_one_packet

puts
puts

puts '# Bin32 Net Format'
client.packet_format = :bin32_net
data = client.send_one_packet

# ap data.snapshot
puts "Serial: #{data.serial_number}"
puts "Voltage: #{data.voltage}"
puts
puts "ABS Watt Seconds #{data.abs_watt_seconds[0, 5]}"
puts "Polarised Watt Seconds #{data.polarised_watt_seconds[0, 5]}"
puts "Current: #{data.current[0, 5]}"

puts "Seconds: #{data.seconds}"
puts "Pulse: #{data.pulse}"
puts "Temperature: #{data.temperature}"

# client.shell

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
green_eye_monitor-0.0.1 exe/green_eye_monitor