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 mbedTimer SDFileSystem MU2 GPS
Diff: inletclose/inletclose.h
- Revision:
- 16:917a2c03bd7c
- Parent:
- 8:6b835a82b1eb
- Child:
- 21:fa4360ec5014
--- a/inletclose/inletclose.h Sun Aug 25 11:10:27 2019 +0000 +++ b/inletclose/inletclose.h Mon Sep 02 14:15:47 2019 +0000 @@ -6,46 +6,47 @@ class Inlet { private: -DigitalOut _Out;//モータ用 1で回転,0で停止 + DigitalOut _Out;//モータ用 1で回転,0で停止 -AnalogIn _In1; -AnalogIn _In2;//感圧センサーとつなぐピン + AnalogIn _In1; + AnalogIn _In2;//感圧センサーとつなぐピン + -float value1;//感圧センサーの値をいれる -float value2; + +public: -public: + float value1;//感圧センサーの値をいれる + float value2; Inlet(PinName Out,PinName In1,PinName In2) - :_Out(Out),_In1(In1),_In2(In2){} - - + :_Out(Out),_In1(In1),_In2(In2) {} + + void Close(float judge)//センサのどっちかがjudgeを超えるとモーターは停止 { _Out=1; - - if(getvalue1()>judge | getvalue2()>judge) - { + + if(getvalue1()>judge | getvalue2()>judge) { _Out=0; - } + } } - + void Stop() { - _Out=0; + _Out=0; } - - float getvalue1() + + float getvalue1() { value1=_In1.read(); - return value1; - } + return value1; + } - float getvalue2() + float getvalue2() { value2=_In2.read(); - return value2; - } + return value2; + } };