Test
hcsr04.h@0:2a1510763167, 2021-01-11 (annotated)
- Committer:
- fermedicius
- Date:
- Mon Jan 11 10:59:03 2021 +0000
- Revision:
- 0:2a1510763167
Test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fermedicius | 0:2a1510763167 | 1 | #ifndef HCSR04_H |
fermedicius | 0:2a1510763167 | 2 | #define HCSR04_H |
fermedicius | 0:2a1510763167 | 3 | #include "mbed.h" |
fermedicius | 0:2a1510763167 | 4 | |
fermedicius | 0:2a1510763167 | 5 | |
fermedicius | 0:2a1510763167 | 6 | |
fermedicius | 0:2a1510763167 | 7 | class HCSR04 { |
fermedicius | 0:2a1510763167 | 8 | public: |
fermedicius | 0:2a1510763167 | 9 | HCSR04(PinName t, PinName e); |
fermedicius | 0:2a1510763167 | 10 | long echo_duration(); |
fermedicius | 0:2a1510763167 | 11 | long distance(); |
fermedicius | 0:2a1510763167 | 12 | |
fermedicius | 0:2a1510763167 | 13 | protected: |
fermedicius | 0:2a1510763167 | 14 | DigitalOut trig; |
fermedicius | 0:2a1510763167 | 15 | DigitalIn echo; |
fermedicius | 0:2a1510763167 | 16 | Timer timer; |
fermedicius | 0:2a1510763167 | 17 | long duration,distance_cm; |
fermedicius | 0:2a1510763167 | 18 | }; |
fermedicius | 0:2a1510763167 | 19 | |
fermedicius | 0:2a1510763167 | 20 | #endif |