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: Servo ServoArm mbed
Fork of PES_Official by
Ultraschall.h
00001 #ifndef ULTRASCHALL_H 00002 #define ULTRASCHALL_H 00003 00004 #include "mbed.h" 00005 00006 /** Ultraschall Class(es) 00007 */ 00008 00009 class Ultraschall 00010 { 00011 public: 00012 /** Create a Ultraschall object connected to the specified pin 00013 * @param pin i/o pin to connect to 00014 */ 00015 Ultraschall(); 00016 Ultraschall(PinName TrigPin,PinName EchoPin); 00017 ~Ultraschall(); 00018 00019 /** Return the distance from obstacle in cm 00020 * @param distance in cms and returns -1, in case of failure 00021 */ 00022 unsigned int get_dist_cm(void); 00023 /** Return the pulse duration equal to sonic waves travelling to obstacle and back to receiver. 00024 * @param pulse duration in microseconds. 00025 */ 00026 unsigned int get_pulse_us(void); 00027 /** Generates the trigger pulse of 10us on the trigger PIN. 00028 */ 00029 void start(void); 00030 void isr_rise(void); 00031 void isr_fall(void); 00032 void fall (void (*fptr)(void)); 00033 void rise (void (*fptr)(void)); 00034 00035 00036 00037 private: 00038 00039 Timer pulsetime; 00040 DigitalOut trigger; 00041 InterruptIn echo; 00042 unsigned int pulsedur; 00043 unsigned int distance; 00044 }; 00045 00046 #endif 00047
Generated on Sun Jul 17 2022 01:45:57 by
