Titech Cansat / Mbed 2 deprecated FM_ver4_for_ARLISS_noMU2

Dependencies:   mbed mbedTimer SDFileSystem MU2 GPS

Committer:
takepiyo
Date:
Sun Aug 18 05:08:10 2019 +0000
Revision:
8:6b835a82b1eb
Parent:
3:4f1bac105598
Child:
16:917a2c03bd7c
add define;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
takepiyo 3:4f1bac105598 1 #include "mbed.h"
takepiyo 3:4f1bac105598 2
takepiyo 3:4f1bac105598 3 #ifndef InletClose_H
takepiyo 3:4f1bac105598 4 #define InletClose_H
takepiyo 3:4f1bac105598 5
takepiyo 3:4f1bac105598 6 class Inlet
takepiyo 3:4f1bac105598 7 {
takepiyo 3:4f1bac105598 8 private:
takepiyo 3:4f1bac105598 9 DigitalOut _Out;//モータ用 1で回転,0で停止
takepiyo 3:4f1bac105598 10
takepiyo 3:4f1bac105598 11 AnalogIn _In1;
takepiyo 3:4f1bac105598 12 AnalogIn _In2;//感圧センサーとつなぐピン
takepiyo 3:4f1bac105598 13
takepiyo 3:4f1bac105598 14 float value1;//感圧センサーの値をいれる
takepiyo 3:4f1bac105598 15 float value2;
takepiyo 3:4f1bac105598 16
takepiyo 3:4f1bac105598 17 public:
takepiyo 3:4f1bac105598 18
takepiyo 3:4f1bac105598 19 Inlet(PinName Out,PinName In1,PinName In2)
takepiyo 3:4f1bac105598 20 :_Out(Out),_In1(In1),_In2(In2){}
takepiyo 3:4f1bac105598 21
takepiyo 3:4f1bac105598 22
takepiyo 3:4f1bac105598 23 void Close(float judge)//センサのどっちかがjudgeを超えるとモーターは停止
takepiyo 3:4f1bac105598 24 {
takepiyo 3:4f1bac105598 25 _Out=1;
takepiyo 3:4f1bac105598 26
takepiyo 3:4f1bac105598 27 if(getvalue1()>judge | getvalue2()>judge)
takepiyo 3:4f1bac105598 28 {
takepiyo 3:4f1bac105598 29 _Out=0;
takepiyo 3:4f1bac105598 30 }
takepiyo 3:4f1bac105598 31 }
takepiyo 3:4f1bac105598 32
takepiyo 8:6b835a82b1eb 33 void Stop()
takepiyo 8:6b835a82b1eb 34 {
takepiyo 8:6b835a82b1eb 35 _Out=0;
takepiyo 8:6b835a82b1eb 36 }
takepiyo 8:6b835a82b1eb 37
takepiyo 3:4f1bac105598 38 float getvalue1()
takepiyo 3:4f1bac105598 39 {
takepiyo 3:4f1bac105598 40 value1=_In1.read();
takepiyo 3:4f1bac105598 41 return value1;
takepiyo 3:4f1bac105598 42 }
takepiyo 3:4f1bac105598 43
takepiyo 3:4f1bac105598 44 float getvalue2()
takepiyo 3:4f1bac105598 45 {
takepiyo 3:4f1bac105598 46 value2=_In2.read();
takepiyo 3:4f1bac105598 47 return value2;
takepiyo 8:6b835a82b1eb 48 }
takepiyo 3:4f1bac105598 49
takepiyo 3:4f1bac105598 50
takepiyo 3:4f1bac105598 51 };
takepiyo 3:4f1bac105598 52
takepiyo 3:4f1bac105598 53 #endif