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
IRSensor.h
00001 /* 00002 * IRSensor.h 00003 * Copyright (c) 2016, ZHAW 00004 * All rights reserved. 00005 */ 00006 00007 #ifndef IR_SENSOR_H_ 00008 #define IR_SENSOR_H_ 00009 00010 #include <cstdlib> 00011 #include <mbed.h> 00012 00013 /** 00014 * This is a device driver class to read the distance measured with a Sharp IR sensor. 00015 */ 00016 class IRSensor 00017 { 00018 00019 public: 00020 // constructors have same name as the class 00021 IRSensor(AnalogIn* distance, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number); 00022 IRSensor(); 00023 00024 void init(AnalogIn* distance, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number); 00025 virtual ~IRSensor(); // deconstructor 00026 float read(); 00027 00028 operator float(); 00029 00030 private: 00031 00032 AnalogIn* distance; 00033 DigitalOut* bit0; 00034 DigitalOut* bit1; 00035 DigitalOut* bit2; 00036 00037 int number; 00038 }; 00039 00040 #endif /* IR_SENSOR_H_ */
Generated on Wed Jul 13 2022 05:37:58 by
1.7.2