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

Create a SensorArray Class #4

Open
theDataSmith opened this issue Dec 12, 2016 · 0 comments
Open

Create a SensorArray Class #4

theDataSmith opened this issue Dec 12, 2016 · 0 comments
Assignees

Comments

@theDataSmith
Copy link
Contributor

theDataSmith commented Dec 12, 2016

Create a class that represents an array of sensors and contains N_SENSORS Sensor objects. It should take an array of pin numbers as an argument in the constructor.

It should have a public function that reads the reflectance from each sensor and returns a weighted average, representing the center of the black line. The weighted average will need to use the relative position of each sensor. These positions should be evenly spaced, and span -1 to 1. The weighted average can be found by the following formula:


Where L is the center of the line, P is the position of each sensor, R is the reflectance of each sensor, and n is the number of sensors.

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

No branches or pull requests

4 participants