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

Doc update #108

Merged
merged 2 commits into from
Dec 22, 2021
Merged

Doc update #108

merged 2 commits into from
Dec 22, 2021

Conversation

ysard
Copy link
Contributor

@ysard ysard commented Dec 22, 2021

Hello here is a small update of the documentation, especially about the color and distance sensor.
The description of the modes was not up to date.

Accepted values for set_color and returned values for COLOR_INDEX modes are not quiet documented but it's unclear for me.

First, I don't have this sensor and I don't know if COLOR_INDEX is the detected color by the sensor, or the current color of
the RGB led.


About set_color: it appears it accept only BLACK/NONE, RED, GREEN and BLUE according to pybricks:

https://github.com/pybricks/pybricks-micropython/blob/master/pybricks/pupdevices/pb_type_pupdevices_colordistancesensor.c


About the detection ability: the official documentation shows "6 colors".
https://brickset.com/sets/88007-1/

Idem in:
https://github.com/JorgePe/BOOSTreveng/blob/master/ColorDistanceSensor.md

I implemented in my own library (https://github.com/ysard/MyOwnBricks) the following colors:

COLOR_NONE 0xFF
COLOR_BLACK 0
COLOR_BLUE 3
COLOR_GREEN 5
COLOR_YELLOW 7
COLOR_RED 9
COLOR_WHITE 10

So there would be an inversion in the naming of the CYAN-GREEN colors here:

COLOR_CYAN = 0x05
COLOR_GREEN = 0x06


About the distance, I don't think it is represented in inches or cm since the data is supposed to be mapped from 0 to 10.

Source:
https://github.com/pybricks/pybricks-micropython/blob/5bf7d4e49ca084bfab3f8889642867b8c49e7a84/pybricks/pupdevices/pb_type_pupdevices_colordistancesensor.c#L115
and:
https://docs.pybricks.com/en/stable/pupdevices/colordistancesensor.html#pybricks.pupdevices.ColorDistanceSensor.distance

and:
JorgePe/BOOSTreveng#33 (comment)

Who is right?

Thanks for reading :p

@undera undera merged commit be2f23c into undera:master Dec 22, 2021
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

Successfully merging this pull request may close these issues.

2 participants