Propose changes for ESP32 and a CustomSensor to be used as simple switch sensor.#3
Open
JorgePe wants to merge 14 commits intoysard:masterfrom
Open
Propose changes for ESP32 and a CustomSensor to be used as simple switch sensor.#3JorgePe wants to merge 14 commits intoysard:masterfrom
JorgePe wants to merge 14 commits intoysard:masterfrom
Conversation
Add 'public' to TiltSensor class definition; Add define condtions to work with ESP32 Seria1 UART
fixes example not compiling
fix example not compiling
propose 'CustomSensor' - it is a crippled version of 'TiltSensor' with a different ID (36d) , a different name for Mode 0 ('MYOWNSWITCH') and just one byte value
Folder for proposed new example
not a folder
propose example for the CustomSensor, a switch connected to one GPIO pin
propose example for the CustomSensor, a switch connected to one GPIO pin
Add condition for ARDUINO_ARCH_RP2040 (like the Raspberry Pi Pico and the Seeed Studio XIAO RP2040)
Switch RX/TX pins for RP2040 boards. Thanks @arohrbacher
Add output to Mode 0
Owner
|
Good evening, thank you for your encouragement and for mentioning my project in the video :) It's been years since I've worked on this quite technical project, and I no longer have the LEGO devices needed to run the tests. So it will take me some time to review your work (and refresh my memory with my own code). Cheers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi!
Someone asked me it it is possible to read the state of a reed switch with Pybricks so I searched for a way to create a custom LEGO compatible sensor, just a simple switch for a start, and found your library. Great work!!
I don't master Arduino, C++ or ESP32 but I managed to use it with a NodeMCU-ESP32 board I already had. Will try a Raspberry Pi Pico later since the ESP32 is overkill.
I am proposing the changes I made - it would help with issue #2
I only tested TiltSensor, it worked (just a typo in exemple). So I copied it and created a CustomSensor, it is basically just the TiltSensor Mode 0 with a different name ('MYOWNSWITH') and just one byte value. I am using Type ID 36 because it's not associated with any known LEGO device (tried higher values but didn't work with Pybricks - https://github.com/orgs/pybricks/discussions/2132).
I am proposing this new device with an example. You can see it working in this video: https://youtu.be/7tQd6HiykZE
In the video I am using a Technic Hub with Pybricks firmware and PUPDevice() class, then read(0)[0] to read mode 0.
Again, I am not a programmer so please excuse me if my code doesn't follow conventions or guidelines. Feel free to change it or even refuse it, I just want to contribute. I appreciate you mentioning me on your project and I also wanted to thank you because your worked helped me and I believe it will also help others.