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
Diff: main.cpp
- Revision:
- 5:7b4575bf205e
- Parent:
- 4:acb62dee5ba9
- Child:
- 6:625384a34dd5
--- a/main.cpp Sat Oct 10 01:11:59 2015 +0000 +++ b/main.cpp Wed Oct 14 04:08:41 2015 +0000 @@ -30,7 +30,8 @@ int begin,end = 0; float frequency = 0; bool flag = false; -int fvalues[] = {0,100,250,500,700,1000}; +//int fvalues[] = {0,100,250,500,700,1000}; +int fvalues[] = {0,102,270,615,948,1623}; int main() { timer.start(); @@ -50,10 +51,10 @@ while(1){ printf("Frequency:-%f\n", frequency); - char c = pc.getc(); - int val = c - 48; - //float adc_val = button.read(); - //int val = getState(adc_val); + //char c = pc.getc(); + //int val = c - 48; + float adc_val = button.read(); + int val = getState(adc_val); pc.printf("Floor-%d\n",val); pc.printf("CurrentState-%d\n",currentState); wait(1); @@ -69,7 +70,7 @@ //wait(2); pc.printf("Floor Frequency value:%d\n",fvalues[val]); while(1){ - if(((frequency > (fvalues[val] - 10)) && (frequency < (fvalues[val] + 10)))){ + if(((frequency > (fvalues[val] - 2)) && (frequency < (fvalues[val] + 2)))){ break; } else{ @@ -89,7 +90,7 @@ pc.printf("Floor Frequency value:-%d\n",fvalues[val]); //while(!((frequency > (fvalues[val] - 50)) && (frequency < (fvalues[val] + 50)))); while(1){ - if(((frequency > (fvalues[val] - 10)) && (frequency < (fvalues[val] + 10)))){ + if(((frequency > (fvalues[val] - 2)) && (frequency < (fvalues[val] + 2)))){ break; } else{ @@ -109,7 +110,7 @@ wait(2); // 2 sec delay pwm1.write(0); // Stop pwm2.write(0); // Stop - wait(2); + //wait(2); } void closeGate(){ @@ -118,7 +119,7 @@ wait(2); // 2 sec delay pwm1.write(0); // Stop pwm2.write(0); // Stop - wait(2); + //wait(2); } int getState(float adc_val){