![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Go to goal robot with follow wall algo
SHARPIR.h@0:efef62b55c86, 2014-04-08 (annotated)
- Committer:
- khaledelmadawi
- Date:
- Tue Apr 08 13:21:17 2014 +0000
- Revision:
- 0:efef62b55c86
Follow wall
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
khaledelmadawi | 0:efef62b55c86 | 1 | /* mbed SHARPIR distance sensor |
khaledelmadawi | 0:efef62b55c86 | 2 | * Copyright (c) 2010 Tomas Johansen |
khaledelmadawi | 0:efef62b55c86 | 3 | * Released under the MIT License: http://mbed.org/license/mit |
khaledelmadawi | 0:efef62b55c86 | 4 | */ |
khaledelmadawi | 0:efef62b55c86 | 5 | |
khaledelmadawi | 0:efef62b55c86 | 6 | #ifndef MBED_SHARPIR_H |
khaledelmadawi | 0:efef62b55c86 | 7 | #define MBED_SHARPIR_H |
khaledelmadawi | 0:efef62b55c86 | 8 | |
khaledelmadawi | 0:efef62b55c86 | 9 | #include "mbed.h" |
khaledelmadawi | 0:efef62b55c86 | 10 | |
khaledelmadawi | 0:efef62b55c86 | 11 | class SHARPIR { |
khaledelmadawi | 0:efef62b55c86 | 12 | public: |
khaledelmadawi | 0:efef62b55c86 | 13 | SHARPIR(PinName AnalogPort); |
khaledelmadawi | 0:efef62b55c86 | 14 | float cm(); |
khaledelmadawi | 0:efef62b55c86 | 15 | float inch(); |
khaledelmadawi | 0:efef62b55c86 | 16 | float volt(); |
khaledelmadawi | 0:efef62b55c86 | 17 | void calibrate(double reg, float exp, double lowerrange, double higherrange); |
khaledelmadawi | 0:efef62b55c86 | 18 | |
khaledelmadawi | 0:efef62b55c86 | 19 | private: |
khaledelmadawi | 0:efef62b55c86 | 20 | AnalogIn _analogin; |
khaledelmadawi | 0:efef62b55c86 | 21 | double lowerrange; |
khaledelmadawi | 0:efef62b55c86 | 22 | double higherrange; |
khaledelmadawi | 0:efef62b55c86 | 23 | double reg; |
khaledelmadawi | 0:efef62b55c86 | 24 | float exp; //trendline excel + datasheet |
khaledelmadawi | 0:efef62b55c86 | 25 | }; |
khaledelmadawi | 0:efef62b55c86 | 26 | |
khaledelmadawi | 0:efef62b55c86 | 27 | #endif |