Hallo Gemeinde,
ich habe ein merkwürdiges Problem.
Dieses Script funktioniert:
#!/usr/bin/env ruby
require 'tinkerforge/ip_connection'
require 'tinkerforge/bricklet_barometer'
include Tinkerforge
@host = '192.168.1.50'
@port = 4223
@uid = '555'
@ipcon = IPConnection.new
@b = BrickletBarometer.new @uid, @ipcon
@ipcon.connect(@host, @port)
air_pressure = @b.get_air_pressure
puts "Air Pressure: #{air_pressure/1000.0} hPa"
Aber dieses
#!/usr/bin/env ruby
class TinkerClass
require 'tinkerforge/ip_connection'
require 'tinkerforge/bricklet_barometer'
include Tinkerforge
def initialize
@host = '192.168.1.50'
@port = 4223
@uid = '555'
@ipcon = IPConnection.new
@b = BrickletBarometer.new @uid, @ipcon
@ipcon.connect(@host, @port)
air_pressure = @b.get_air_pressure
puts "Air Pressure: #{air_pressure/1000.0} hPa"
end
tinker = TinkerClass.new
end
wirft folgende Exception:
/ip_connection.rb:734:in `create_packet_header': undefined method `pack' for #<Tinkerforge::IPConnection:0x305a1e0> (NoMethodError)
Tinkerforge gem Version 2.1.13
Ruby Version 2.3.3
Windows 10 pro x64
Hat jemand eine Idee?