Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

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?

 

 

 

 

Geschrieben

Der Unterschied ist, dass du

 

require 'tinkerforge/ip_connection'
require 'tinkerforge/bricklet_barometer'
include Tinkerforge

 

im zweiten Fall in der class hast. Wenn du es vor die class packst dann funktioniert es.

 

Test mal bitte die angehängt ip_connection.rb Datei. Mit der sollte es auch in der class funktionieren.

ip_connection.rb

Geschrieben
  • Autor

Super! Danke!

Das habe ich die ganze Zeit übersehen :-)

Es funktioniert jetzt wie gewollt.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.