Skip to content

Create a SensorArray Class #4

Description

@theDataSmith

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.

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions