You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: