Titech Cansat / Mbed 2 deprecated FM_ver4_for_ARLISS_noMU2

Dependencies:   mbed mbedTimer SDFileSystem MU2 GPS

Committer:
Nerosho
Date:
Mon Sep 02 14:15:47 2019 +0000
Revision:
16:917a2c03bd7c
Parent:
8:6b835a82b1eb
Child:
21:fa4360ec5014
0902

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