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 SDFileSystem
inletclose.h
00001 #include "mbed.h" 00002 00003 #ifndef InletClose_H 00004 #define InletClose_H 00005 00006 class Inlet 00007 { 00008 private: 00009 DigitalOut _Out;//モータ用 1で回転,0で停止 00010 00011 AnalogIn _In1; 00012 AnalogIn _In2;//感圧センサーとつなぐピン 00013 00014 float value1;//感圧センサーの値をいれる 00015 float value2; 00016 00017 public: 00018 00019 Inlet(PinName Out,PinName In1,PinName In2) 00020 :_Out(Out),_In1(In1),_In2(In2){} 00021 00022 00023 void Close(float judge)//センサのどっちかがjudgeを超えるとモーターは停止 00024 { 00025 _Out=1; 00026 00027 if(getvalue1()>judge | getvalue2()>judge) 00028 { 00029 _Out=0; 00030 } 00031 } 00032 00033 void Stop() 00034 { 00035 _Out=0; 00036 } 00037 00038 float getvalue1() 00039 { 00040 value1=_In1.read(); 00041 return value1; 00042 } 00043 00044 float getvalue2() 00045 { 00046 value2=_In2.read(); 00047 return value2; 00048 } 00049 00050 00051 }; 00052 00053 #endif
Generated on Sun Jul 24 2022 22:05:25 by
1.7.2