Sha256: a9c40767e2ddf89aeb22286bb2da4ef56bb5faf529027120945452cb0d5116c0

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 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.string '--port', 'serial port', default: '/dev/ttyUSB1'
  o.on '--version', 'print the version' do
    puts Slop::VERSION
    exit
  end
end

client = GreenEyeMonitor::Client.new(:baud => 115_200, :serial_port => opts[:port], :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.2 exe/green_eye_monitor