Pratit Nayak
/
tsi_name
tsi name
main.cpp
- Committer:
- pratit911
- Date:
- 2018-05-30
- Revision:
- 0:691801d15035
File content as of revision 0:691801d15035:
#include "mbed.h" #include "tsi_sensor.h" #if defined(TARGET_KL25Z) #define ELEC0 9 #define ELEC1 10 #else #error TARGET NOT DEFINED #endif DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); Serial pc(USBTX, USBRX); float touch; int main(void) { TSIAnalogSlider tsi(ELEC1, ELEC0, 75); while(true) { myled1=1; myled2=1; myled3=1; touch=tsi.readPercentage(); if(touch<0.33 && touch>0) {myled1=0; myled2=1; myled3=1; pc.printf("PRATIT\n"); wait(0.1);} if(touch>0.33 && touch<0.66) {myled1=1; myled2=0; myled3=1; pc.printf("NAYAK\n"); wait(0.1);} if(touch>0.66) {myled1=1; myled2=1; myled3=0; pc.printf("POKHARIPUT\n"); wait(0.1);} wait(0.1); } }