Skip to content

Added get_distance() to ColourDistanceSensor #157

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

Merged
merged 6 commits into from
Jul 18, 2022

Conversation

highflying
Copy link
Contributor

The distance values returned from the build hat don't seem to reflect any particular unit of distance, a value of 0 to 10 is returned, which is good enough for me to use for proximity detection.

@mutesplash
Copy link
Contributor

Looking at the modes returned from my device, it seems like distance (PROX...imity) should be mode 1, not 6. Six seems to be RGB readings.

You've got this connected to the BuildHAT and tested the code using it, correct?
https://www.lego.com/en-us/product/color-distance-sensor-88007

@highflying
Copy link
Contributor Author

highflying commented Jul 17, 2022

Looking at the modes returned from my device, it seems like distance (PROX...imity) should be mode 1, not 6. Six seems to be RGB readings.

You've got this connected to the BuildHAT and tested the code using it, correct? https://www.lego.com/en-us/product/color-distance-sensor-88007

Sorry, yes this is tested on a Raspberry Pi 3+ with the BuildHAT attached, I had just forgotten to commit that last change I had made directly on the raspberry pi to use mode 1. This PR now correctly uses mode 1.
2022-07-17 19 39 46

Copy link
Contributor

@chrisruk chrisruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, just tested it, will approve and merge now.

@chrisruk chrisruk merged commit efe5557 into RaspberryPiFoundation:main Jul 18, 2022
highflying added a commit to highflying/python-build-hat that referenced this pull request Jul 20, 2022
Added get_distance() to ColourDistanceSensor (RaspberryPiFoundation#157)
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.

3 participants