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

Servus zusammen,

 

ich habe das von Tinkerforge gestellte Beispielprogramm für den RTC auf den Red-Brick hochgeladen.Leider bekomme ich immer diese Fehlermeldung:

 

Traceback (most recent call last):

  File "example_callback.py", line 32, in <module>

    rtc.register_callback(rtc.CALLBACK_DATE_TIME, cb_date_time)

AttributeError: 'BrickletRealTimeClock' object has no attribute 'register_callback'

 

Wer ne Idee? Vielen Dank!

#!/usr/bin/env python
# -*- coding: utf-8 -*-

HOST = "localhost"
PORT = 4223
UID = "xKG" # Change XYZ to the UID of your Real-Time Clock Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_real_time_clock import BrickletRealTimeClock

# Callback function for date and time callback
def cb_date_time(year, month, day, hour, minute, second, centisecond, weekday, timestamp):
    print("Year: " + str(year))
    print("Month: " + str(month))
    print("Day: " + str(day))
    print("Hour: " + str(hour))
    print("Minute: " + str(minute))
    print("Second: " + str(second))
    print("Centisecond: " + str(centisecond))
    print("Weekday: " + str(weekday))
    print("Timestamp: " + str(timestamp))
    print("")

if __name__ == "__main__":
    ipcon = IPConnection() # Create IP connection
    rtc = BrickletRealTimeClock(UID, ipcon) # Create device object

    ipcon.connect(HOST, PORT) # Connect to brickd
    # Don't use device before ipcon is connected

    # Register date and time callback to function cb_date_time
    rtc.register_callback(rtc.CALLBACK_DATE_TIME, cb_date_time)

    # Set period for date and time callback to 5s (5000ms)
    # Note: The date and time callback is only called every 5 seconds
    #       if the date and time has changed since the last call!
    rtc.set_date_time_callback_period(5000)

    
    ipcon.disconnect()

Geschrieben

Die Python Bindings im aktuellen RED Brick Image sind leider nicht auf dem aktuellsten Stand.

 

Es wird demnächst eine Möglichkeit geben die Bindings über Brick Viewer zu aktualisieren. Bis das allerdings soweit ist, musst du selbst Hand anlegen.

 

Entweder du lädst neben deinem Programm auch die aktuellen Bindings mit hoch, oder aktualisiert die installierten Bindings über die Console im Brick Viewer mit folgendem Befehl:

 

sudo pip install --upgrade tinkerforge

 

Dazu braucht der RED Brick allerdings Internetverbindung.

Geschrieben
  • Autor

Könnte mir vll kurz wer erklären wie ich die API Bindings dann hochlade? Vielen Dank!

  • 2 weeks later...

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.