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: FastAnalogIn mbed-rtos mbed
Fork of dipl_prace_v10 by
ultrasonic.h
- Committer:
- romankrej
- Date:
- 2015-04-26
- Revision:
- 0:f3b355df6f26
File content as of revision 0:f3b355df6f26:
#ifndef _ULTRASONIC_H
#define _ULTRASONIC_H
#include "mbed.h"
#include "rtos.h"
class cUltrasonic {
public:
cUltrasonic(PinName pinEcho, PinName pinTrig);
/* This method set trigger */
void setTrig();
/* This method returns width of received pulse*/
int getPulseWidth();
/* Pointer to thread*/
Thread* thread;
private:
DigitalOut trig;
InterruptIn echo;
Timer timer;
float pulseWidth;
/* ISR of rising edge */
void riseEdge(void);
/* ISR of falling edge*/
void fallEdge(void);
};
#endif
