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.
us015.h
00001 #ifndef __US015_H 00002 #define __US015_H 00003 00004 #include "mbed.h" 00005 00006 00007 //==================================== 00008 // define定義 00009 //==================================== 00010 #define US015_TRIGER_ON 1 // トリガーON 00011 #define US015_TRIGER_OFF 0 // トリガーOFF 00012 #define US015_TRIGER_PALUSE_WIDTH 10 // トリガーの幅 00013 #define US015_PERIODIC_TRIGER 100000 // 音響測距トリガー 00014 #define US015_SOUND_OF_SPEED 0.340 // 音速[mm/us] 00015 00016 00017 //==================================== 00018 // 音響測距センサ(US015)の制御クラス 00019 //==================================== 00020 class US015 00021 { 00022 public: 00023 US015(PinName trg, PinName ech); 00024 US015(PinName trg, PinName ech, float tkTime); 00025 float GetDistance(); 00026 void TrigerOut(); // トリガー出力 00027 00028 private: 00029 DigitalOut _trigerOut; // U015トリガー出力 00030 InterruptIn _interruptEcho; // U015エコー入力 00031 Timer timer; // 時間計測用のタイマ 00032 Ticker tk; // 周期処理用のチッカー 00033 float tmBegin; // エコーの立ち上がり時間 00034 float tmEnd; // エコーの立ち下がり時間 00035 float distance; // 距離測定 00036 void EchoFall(); // エコーの立ち下がり処理 00037 void EchoRise(); // エコーの立ち上がり処理 00038 }; 00039 00040 #endif
Generated on Mon Sep 12 2022 23:21:05 by
1.7.2