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
us015.h@0:f728b8e6bdf2, 2019-11-15 (annotated)
- Committer:
 - KINU
 - Date:
 - Fri Nov 15 14:02:01 2019 +0000
 - Revision:
 - 0:f728b8e6bdf2
 
us015sb612Camera
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| KINU | 0:f728b8e6bdf2 | 1 | #ifndef __US015_H | 
| KINU | 0:f728b8e6bdf2 | 2 | #define __US015_H | 
| KINU | 0:f728b8e6bdf2 | 3 | |
| KINU | 0:f728b8e6bdf2 | 4 | #include "mbed.h" | 
| KINU | 0:f728b8e6bdf2 | 5 | |
| KINU | 0:f728b8e6bdf2 | 6 | |
| KINU | 0:f728b8e6bdf2 | 7 | //==================================== | 
| KINU | 0:f728b8e6bdf2 | 8 | // define定義 | 
| KINU | 0:f728b8e6bdf2 | 9 | //==================================== | 
| KINU | 0:f728b8e6bdf2 | 10 | #define US015_TRIGER_ON 1 // トリガーON | 
| KINU | 0:f728b8e6bdf2 | 11 | #define US015_TRIGER_OFF 0 // トリガーOFF | 
| KINU | 0:f728b8e6bdf2 | 12 | #define US015_TRIGER_PALUSE_WIDTH 10 // トリガーの幅 | 
| KINU | 0:f728b8e6bdf2 | 13 | #define US015_PERIODIC_TRIGER 100000 // 音響測距トリガー | 
| KINU | 0:f728b8e6bdf2 | 14 | #define US015_SOUND_OF_SPEED 0.340 // 音速[mm/us] | 
| KINU | 0:f728b8e6bdf2 | 15 | |
| KINU | 0:f728b8e6bdf2 | 16 | |
| KINU | 0:f728b8e6bdf2 | 17 | //==================================== | 
| KINU | 0:f728b8e6bdf2 | 18 | // 音響測距センサ(US015)の制御クラス | 
| KINU | 0:f728b8e6bdf2 | 19 | //==================================== | 
| KINU | 0:f728b8e6bdf2 | 20 | class US015 | 
| KINU | 0:f728b8e6bdf2 | 21 | { | 
| KINU | 0:f728b8e6bdf2 | 22 | public: | 
| KINU | 0:f728b8e6bdf2 | 23 | US015(PinName trg, PinName ech); | 
| KINU | 0:f728b8e6bdf2 | 24 | US015(PinName trg, PinName ech, float tkTime); | 
| KINU | 0:f728b8e6bdf2 | 25 | float GetDistance(); | 
| KINU | 0:f728b8e6bdf2 | 26 | void TrigerOut(); // トリガー出力 | 
| KINU | 0:f728b8e6bdf2 | 27 | |
| KINU | 0:f728b8e6bdf2 | 28 | private: | 
| KINU | 0:f728b8e6bdf2 | 29 | DigitalOut _trigerOut; // U015トリガー出力 | 
| KINU | 0:f728b8e6bdf2 | 30 | InterruptIn _interruptEcho; // U015エコー入力 | 
| KINU | 0:f728b8e6bdf2 | 31 | Timer timer; // 時間計測用のタイマ | 
| KINU | 0:f728b8e6bdf2 | 32 | Ticker tk; // 周期処理用のチッカー | 
| KINU | 0:f728b8e6bdf2 | 33 | float tmBegin; // エコーの立ち上がり時間 | 
| KINU | 0:f728b8e6bdf2 | 34 | float tmEnd; // エコーの立ち下がり時間 | 
| KINU | 0:f728b8e6bdf2 | 35 | float distance; // 距離測定 | 
| KINU | 0:f728b8e6bdf2 | 36 | void EchoFall(); // エコーの立ち下がり処理 | 
| KINU | 0:f728b8e6bdf2 | 37 | void EchoRise(); // エコーの立ち上がり処理 | 
| KINU | 0:f728b8e6bdf2 | 38 | }; | 
| KINU | 0:f728b8e6bdf2 | 39 | |
| KINU | 0:f728b8e6bdf2 | 40 | #endif |