
123
Diff: main.cpp
- Revision:
- 0:e85d5d2f66a5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 31 06:10:14 2017 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" +#include "TSISensor.h" +Serial pc(USBTX,USBRX); +TSISensor TSI; +float i; +DigitalOut plus(PTB8); +DigitalOut neg(PTB9); + +int main() { + while(1) { + i=(100*TSI.readPercentage()); + if(i>0) + { + if(i>=0& i<=40) + { + plus = 1; + neg = 0; + } + else if(i>=45& i<=60) + { + plus = 0; + neg = 0; + } + else if(i>=70& i<=100) + { + plus = 0; + neg = 1; + } + } +}}