zhouhang shao
/
test
test
Diff: IRSensor.h
- Revision:
- 1:11970e541ecf
- Parent:
- 0:3c59bc5c9388
--- a/IRSensor.h Sun Feb 26 20:29:20 2017 +0000 +++ b/IRSensor.h Thu Mar 23 04:23:49 2017 +0000 @@ -1,5 +1,5 @@ -#ifndef IR_H -#define IR_H +#ifndef IRSENSOR_H +#define IRSENSOR_H #include "mbed.h" @@ -30,6 +30,7 @@ float readIR(){ float sum = 0; + //Each duration takes 100us, 5 times = 0.5ms for (int i = 0; i < 5; i++) { @@ -64,7 +65,7 @@ _value += COEFF_6 * square; _value += COEFF_7 * square * sum; - return _value; + return value; } //Get the number of cells away wall is