Skip to content
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 RGB and HSV to Technic Color Sensor #172

Open
tylerfowle opened this issue Oct 20, 2022 · 1 comment
Open

add RGB and HSV to Technic Color Sensor #172

tylerfowle opened this issue Oct 20, 2022 · 1 comment

Comments

@tylerfowle
Copy link

tylerfowle commented Oct 20, 2022

Add the ability to get the RGB and/or HSV values from the Technic Color Sensor.
https://docs.pybricks.com/en/stable/pupdevices/colorsensor.html#pybricks.pupdevices.ColorSensor.hsv

Add the ability to customize the default detectable colors. Similar to what pybricks does. https://docs.pybricks.com/en/stable/pupdevices/colorsensor.html#pybricks.pupdevices.ColorSensor.detectable_colors

Additionally, it would be nice if these could be getter functions so you can query the color at a specific time, rather than the current Event system.

Debenben added a commit to Debenben/node-poweredup that referenced this issue Jan 15, 2023
@Debenben
Copy link
Contributor

@tylerfowle I made a proposal for implementing some of the missing sensor modes. Until the changes are merged to the main repo here, you can use my fork https://www.npmjs.com/package/@debenben/node-poweredup where a couple of other pull requests are merged, too.

This library will never be as fast as pybricks when getting sensor values. To have something like a getter, you could do:

const hsvValue = await new Promise(res => {sensor.once('hsvAmbient', val => res(val))});

or use the undocumented function

sensor.requestUpdate();

which triggers an update of the sensor value regardless of changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants