![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ノイズを付加した正弦波発生器 Sinusoidal wave generator with noise.
Dependencies: F746_GUI F746_SAI_IO Random mbed
Diff: MyFiles/Trigger.hpp
- Revision:
- 0:31361b0fcdad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MyFiles/Trigger.hpp Sun Nov 04 02:41:21 2018 +0000 @@ -0,0 +1,25 @@ +//--------------------------------------------------------------- +// トリガの条件を満足する点を探す +// +// 2017/07/24, Copyright (c) 2017 MIKAMI, Naoki +//--------------------------------------------------------------- + +#ifndef F746_TRIGGER_HPP +#define F746_TRIGGER_HPP + +#include "mbed.h" +#include "Array.hpp" + +namespace Mikami +{ + int Trigger(const Array<int16_t>& xn, // 対象とするデータ + int th) // トリガの基準値 + { + int n; + for (n=1; n<xn.Length()/2; n++) + if ((xn[n-1] < -th) && (xn[n] > th)) + return n; + return 0; + } +} +#endif // F746_TRIGGER_HPP