Ashmeet Singh Rekhi
/
mbed_elevator
ese519
Revision 8:ae5df9496557, committed 2015-10-15
- Comitter:
- mfrede
- Date:
- Thu Oct 15 07:21:21 2015 +0000
- Parent:
- 7:1ccdc92259f4
- Commit message:
- this works better
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1ccdc92259f4 -r ae5df9496557 main.cpp --- a/main.cpp Thu Oct 15 07:09:55 2015 +0000 +++ b/main.cpp Thu Oct 15 07:21:21 2015 +0000 @@ -18,7 +18,7 @@ freq.reset(); } else { int diff = freq.read_us(); - pc.printf("edgediff: %d\r\n",diff); + // pc.printf("edgediff: %d\r\n",diff); if(diff < 10100 && diff> 9900) floorat = 1; @@ -53,7 +53,7 @@ short get_requested(float voltage){ // pc.printf("voltage: %f\r\n",voltage); - if(voltage < 0.34f) + if(voltage < 0.30f) return 1; else if (voltage < 0.55f) return 2; @@ -75,7 +75,7 @@ DigitalOut motor1(p19); DigitalOut motor2(p20); //int floorat; - DCenable.period(0.0002f); + DCenable.period(0.02f); floor.rise(&edgecnter); @@ -88,7 +88,7 @@ //go up until you find a floor motor1 = 0; motor2 = 1; - DCenable = 0.8f; + DCenable = 0.5f; short current_floor = floorat; @@ -104,12 +104,12 @@ pc.printf("go up\r\n"); motor1 = 0; motor2 = 1; - DCenable = 0.8f; + DCenable = 0.5f; } else if(get_requested(request) < current_floor) { pc.printf("go down\r\n"); motor1 = 1; motor2 = 0; - DCenable = 0.8f; + DCenable = 0.5f; } else { motor1=0; motor2=0;