-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add interface for EV3 buttons #13
Comments
Is this hard? I am working on a project, I started using the nodejs bindings because the project fits the "async" paradigm well, I know Javascript very well and I never used Python, but just now I noticed that button support is missing. What would be needed to add button support? |
No, this should not be hard; I have written some proof-of-concept Node.js code previously that read the button states. The main reason that I haven't done it yet is that it requires polling to detect changes in button states, and I didn't previously have infrastructure in the library to do that cleanly. I do have such infrastructure now, so adding buttons should be reasonably easy; I can go find the work I have done so far in a few hours. I'll post some example code here so that you are able to use the buttons without waiting for me if your project is time-sensitive, |
I've uploaded my button demo here. The code watches the input event file and asynchronously parses and handles events as they are received. I plan to integrate this functionality into the library soon, but until then feel free to adapt my example to your needs. I added some comments to try to explain what's going on; feel free to ask if the code is unclear or something isn't working correctly. The code makes some assumptions about the platform that it's running on (e.g. that it's little endian) but should work on all the ev3dev-supported platforms. |
No description provided.
The text was updated successfully, but these errors were encountered: