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.
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.