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,

 

ich versuche ein Programm zu schreiben, dass beendet wird sobald von einem TF Aktuator ein Event eintritt. Im Moment nutze ich den Threshold von einem Poti dafür.

 

Es klappt auch soweit, nur bleibt in der Konsole der raw_input stehen. Wie kann man das umgehen? Ich habe es mit einer while-Schleife probiert aber ich bekomme den Wert des Thresholds nicht in die Schleife.

 

Wäre für Tipps sehr dankbar.

 

Hier mein Code:

 

HOST = "localhost"
PORT = 4223
UID_TEMP = 'zv2'
UID_OLED = 'Bgv'
UID_ROTA = 'g5H'

stop = 0.0

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_temperature import BrickletTemperature
from tinkerforge.bricklet_rotary_poti import BrickletRotaryPoti
from tinkerforge.bricklet_oled_128x64 import BrickletOLED128x64

import sys

def cb_temperature(temperature):
    oled.write_line(0, 0, 'Temperature: ' + str(temperature/100.0) + ' C')
    
def cb_position(position):
    oled.clear_display()
    ipcon.disconnect()
    
if __name__ == "__main__":
    
    ipcon = IPConnection()
    
    t = BrickletTemperature(UID_TEMP, ipcon)
    rp = BrickletRotaryPoti(UID_ROTA, ipcon)
    oled = BrickletOLED128x64(UID_OLED, ipcon)

    ipcon.connect(HOST, PORT)

    t.register_callback(t.CALLBACK_TEMPERATURE, cb_temperature)
    t.set_temperature_callback_period(1000)
    
    rp.register_callback(rp.CALLBACK_ANALOG_VALUE_REACHED, cb_position)
    rp.set_debounce_period(100)
    rp.set_analog_value_callback_threshold('>', 3000.0, 4095)  
    
    raw_input("Press key to exit\n")

Geschrieben
  • Autor

Hallo,

 

das habe ich auch schonmal gemacht, allerdings bleibt dann in der Konsole der raw_input stehen.

 

Eben den will ich umgehen.

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.