Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
ir_sensor.h
00001 #ifndef IR_H 00002 #define IR_H 00003 #include "mbed.h" 00004 extern Serial pc; 00005 00006 class IRSensor { 00007 public: 00008 DigitalOut _enable; 00009 AnalogIn _input; 00010 // volatile short value; 00011 00012 IRSensor(PinName enable, PinName input) : _enable(enable), _input(input){} 00013 00014 // Calculate an estimated IR value 00015 float readIR(); 00016 00017 //Get the number of cells away wall is 00018 // short cell_dist(); 00019 00020 //Shorthand for read() 00021 operator short() { 00022 return readIR(); 00023 } 00024 }; 00025 00026 extern IRSensor rightIR; 00027 extern IRSensor rightDiagonalIR; 00028 extern IRSensor leftDiagonalIR; 00029 /* 00030 extern IRSensor rightDiagonalIR; 00031 extern IRSensor rightFrontIR; 00032 extern IRSensor leftFrontIR; 00033 extern IRSensor leftDiagonalIR; 00034 */ 00035 extern IRSensor leftIR; 00036 00037 00038 #endif
Generated on Thu Jul 14 2022 05:30:38 by
