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

Dear List

I am using the Rugged Approach approach for programming in C# and in Python. It just works perfectly! Thanks for the great tutorial.

Till now, I worked with many bricklets, but each of a different type. For this case, the approach and code in the tutorial works like a charm.

Question:

  • But what would be the best-practice, if you have several bricklets of the same type?

Of course, I could use the UID of the individual bricklets to make the differentiation of the individual bricklets. But I would like to avoid the usage of the UID in Rugged Approach for several reasons:

  • Lost of the very generic procedure of the Rugged Approach introducing somehow hard-coded UIDs of bricklet.
  • Incompatibility of several installations of hardware having different UIDs.

In the specific application I am working on, the bricklets are connected with a HAT Brick.

Question:

  • Is there a possibility to avoid the UIDs?
  • Could I use the information of the ports were each of the bricklet is connected to? In this case, I have to make sure, that each bricklet is connected with a well defined port. An approach which could be realistic. The information of the port connected to would be based on the return value of the get_identity() function of each bricklet.
  • If I would use the UIDs, is it reasonable/possible to change the UIDs of the individual bricklets to have the same UIDs of the bricklets in each identical installation of the hardware.

Looking forward to any ideas and suggestions.

Cheers,

Yvo

Geschrieben

Hi Yvo,

I think the best way is the position of the bricklet. So you have to plug the bricklets to the same positions and you can identify them with the enumeration callback.

It is also possible to override the UID with the Brick Viewer, but for this you have to connect each bricklet and override the UID.

I think first way is better because hardware is like it is. It is more plug and play (work) :)

Greets

Chris

Geschrieben
  • Autor

Hi Backdraft007

Perfect. Thank you very much. In this case, I will go with the positions of the bricklets. That sounds the most promising.

Cheers,

Yvo

  • 7 months later...
Geschrieben
  • Autor

Dear list

In the meantime, I implemented the proposed approach of Backdraft007 using the connection-position of the bricklet at the HAT. That works perfectly. Usually I am using wrapper-classes for the individual types of bricklets.

In this case, I am using multiple IndustrialDualRelais with different jobs each.

The rugged-approach is simply extended by a variable and a if-clause to decided, if the bricklet will be connected or not:

    def _callbackEnumerate(self,
        uid, connectedUid, 
        position, hardwareVersion, firmwareVersion, 
        deviceIdentifier, enumerationType):

        if enumerationType == IPConnection.ENUMERATION_TYPE_CONNECTED or \
           enumerationType == IPConnection.ENUMERATION_TYPE_AVAILABLE:
            
            if deviceIdentifier == BrickletIndustrialDualRelay.DEVICE_IDENTIFIER:
                if position.upper() == PermanentPower.POSITION_HAT.upper():
                    self._dualRelais = BrickletIndustrialDualRelay(uid, self._ipcon)

The constant value POSITION_HAT defines the position of the connection at the HAT (A ... H).

For my applications, this approach solves the requirements,

Cheers. Yvo

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.