qtr_sensor¶
- class qtr_sensor.QTRSensor(pins, ctrl)¶
Bases:
object
A class to handle QTR Reflectance Array Sensors.
- pins¶
pin values for each IR LED and the control pin.
- Type:
list
- control¶
Pin object for the control pin.
- Type:
Pin
- white¶
calibration readings for white background.
- Type:
list
- black¶
calibration readings for black background.
- Type:
list
- calibrate_black()¶
Calibrates IR sensor Sets white and black set-points for readings
- calibrate_white()¶
Calibrates IR sensor Sets white and black set-points for readings
- centroid()¶
- readIR()¶
Reads all 7 Ir sensors and computes the centroid
- readRaw()¶
Read raw sensor values from QTR sensors.
- class qtr_sensor.QTRTask(qtr_array)¶
Bases:
object
A class to handle QTR Reflectance Array Sensors.
- qtr_array¶
Normalized sensor readings for each sensor.
- Type:
list
- S0_init¶
State 0 value for initialization.
- Type:
int
- S1_read¶
State 1 value for reading.
- Type:
int
- state¶
State of the FSM.
- Type:
int
- get_line(shares)¶
The generator that implements teh FSM for the QTR task.
State 0 initializes the generator. State 1 reads the sensor and computes the centroid which corresponds to the current error.
- Parameters:
shares (int) – Line error shared variable for controller.
- Yields:
state (int) – The value of the current state within the machine