Comments (6)
Thanks, @cpseager , that did it! I got both button sets working. I will clean up my branch and make a pull request.
from pylgbst.
Remote buttons are a unique sensor type (id 55) so you need to add a new peripheral class (not Button) to handle this type of sensor.
from pylgbst.
@cpseager thanks for the hint! I noticed that Button
differs from other sensors by lacking its own implementation of _decode_port_data
. So I created a subclass of Peripheral
named RemoteButton
, where I implement the subscribe
and unsubscribe
methods, and I added a bare _decode_port_data
that, for initial debugging, just prints its parameter. No difference with what I had before. The subscription mechanism works, but the only button that sends callback notifications is the green hub button, which is not even mapped in the class. I can trace the internals of the bluetooth messaging in the computer, and see that nothing seems to come out of the remote buttons when they are pressed. I checked it with two remotes, so it's not a defect in the hardware. I am at loss on what is going on.
from pylgbst.
On the remote the two buttons are configured as ‘external’ sensors (id 55) on ‘internal’ ports 0 and 1. This makes sense, as in this case you cannot configure them as two dedicated ‘internal’ ports (like Voltage or Button ports) as they would both need to use the same port id number.
Therefore a quick scan of your dev branch shows you have appeared to try to configure the RemoteButton as an internal port (like Button) rather than external (like VisionSensor). In particular your subscribe will need to be something along the lines of
def subscribe(self,callback, mode=0, granularity=1):
super().subscribe(callback, mode, granularity)
from pylgbst.
I created PR #132 to implement the remote (cc @undera )
from pylgbst.
I have added some comments on the code, please address those.
from pylgbst.
Related Issues (20)
- LEDRGB: Current color can't be obtained/notified from the hub HOT 4
- Cannot connect to 88015 hub HOT 1
- Error on MacOS HOT 5
- 'MoveHub' object has no attribute 'connection' HOT 2
- Any plans for adding other hubs, maybe Mindstorms 515151? HOT 5
- [motors]Is there a way to ? HOT 1
- Technic Hub Port AB doesnt work HOT 16
- Connecting to WeDo SmartHub: no characteristic found HOT 7
- Blue Tooth Connection HOT 6
- Cannot run a Lego tram HOT 25
- How to get Sound Files with Lego Boost app? HOT 1
- Calling hub methods from callback functions blocks further operations HOT 6
- Crashes from time to time calling bluepy function HOT 14
- How to control a DC (train) motor ? HOT 40
- Is pylgbst thread-safe? HOT 2
- To bleak or not to bleak...? HOT 3
- AttributeError: 'NoneType' object has no attribute 'timed' HOT 3
- Proper way to detect if motor is stuck during its move? HOT 3
- Remote WARNING:peripherals:Attempt to unsubscribe while port value updates are off: RemoteButton on port 0x0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylgbst.