
Team Design project 3 main file
Dependencies: mbed Motor_Driver Sensors MMA8451Q LocalPositionSystem
Fork of TDP_main by
Diff: sensor_measure.h
- Revision:
- 23:9b53c72fcd38
- Parent:
- 22:902c3086394e
- Child:
- 26:7b67bcbddde3
- Child:
- 30:307b45a52401
--- a/sensor_measure.h Sat Mar 21 13:08:53 2015 +0000 +++ b/sensor_measure.h Sun Mar 22 23:32:36 2015 +0000 @@ -19,6 +19,7 @@ #define NUMBER_SAMPLES 20 // NUMBER OF SAMPLES FOR SENSOR TESTING #define NUMBER_SENSORS_REGULAR 8 // number for the array of sensors #define NUMBER_SENSORS_SQUARE 0 +#define BLACK_THRESHOLD 2 //define pinout for all the sensors DigitalIn pin_right_right_up(PTE29); @@ -64,49 +65,49 @@ int arrayBuilder = 0; //integer solely used for populating the array //right_right right_right_up.pin = &pin_right_right_up; - right_right_up.blackValue = 10000; + right_right_up.blackValue = 10000*BLACK_THRESHOLD; right_right_up.whiteValue = 48000; right_right_up.grayValue = 0; // 0 for all the non-square sensors right_right_up.state = 0; //setting all sensors as black at begging sensorArray [arrayBuilder++] = &right_right_up; //Array goes from rightmost to left, then centre? right_left_up.pin = &pin_right_left_up; - right_left_up.blackValue = 30000; + right_left_up.blackValue = 30000*BLACK_THRESHOLD; right_left_up.whiteValue = 115000; right_left_up.grayValue = 0; right_left_up.state = 1; sensorArray [arrayBuilder++] = &right_left_up; right_right_down.pin = &pin_right_right_down; - right_right_down.blackValue = 7000; + right_right_down.blackValue = 7000*BLACK_THRESHOLD; right_right_down.whiteValue = 20000; right_right_down.grayValue = 0; right_right_down.state = 0; sensorArray [arrayBuilder++] = &right_right_down; right_left_down.pin = &pin_right_left_down; - right_left_down.blackValue = 8000; + right_left_down.blackValue = 8000*BLACK_THRESHOLD; right_left_down.whiteValue = 25000; right_left_down.grayValue = 0; right_left_down.state = 1; sensorArray[arrayBuilder++] = &right_left_down; left_right_down.pin = &pin_left_right_down; - left_right_down.blackValue = 2500; + left_right_down.blackValue = 2500*BLACK_THRESHOLD; left_right_down.whiteValue = 21000; left_right_down.grayValue = 0; left_right_down.state = 1; sensorArray [arrayBuilder++] = &left_right_down; left_left_down.pin = &pin_left_left_down; - left_left_down.blackValue = 6500; + left_left_down.blackValue = 6500*BLACK_THRESHOLD; left_left_down.whiteValue = 21000; left_left_down.grayValue = 0; left_left_down.state = 0; sensorArray [arrayBuilder++] = &left_left_down; left_right_up.pin = &pin_left_right_up; - left_right_up.blackValue = 20000; //??? it's a trick ;) + left_right_up.blackValue = 20000*BLACK_THRESHOLD; //??? it's a trick ;) left_right_up.whiteValue = 79000; left_right_up.grayValue = 0; left_right_up.state = 1; sensorArray [arrayBuilder++] = &left_right_up; left_left_up.pin = &pin_left_left_up; - left_left_up.blackValue = 27000; + left_left_up.blackValue = 27000*BLACK_THRESHOLD; left_left_up.whiteValue = 120000; left_left_up.grayValue = 0; left_left_up.state = 0; @@ -146,7 +147,7 @@ // sensor->state = 2; // return 2; // } -// if (freq < (2*sensor->blackValue)){ +// if (freq < (sensor->blackValue)){ // sensor->state = 0; //if it's less than black value it is black // return 0; // }