elevator
/
Elevator_movement_proportional
proportional
Revision 0:37a74423d68e, committed 2015-02-19
- Comitter:
- Ty
- Date:
- Thu Feb 19 14:31:05 2015 +0000
- Commit message:
- proportional
Changed in this revision
diff -r 000000000000 -r 37a74423d68e Motor.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor.lib Thu Feb 19 14:31:05 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Motor/#f265e441bcd9
diff -r 000000000000 -r 37a74423d68e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 19 14:31:05 2015 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" +#include "Motor.h" +Serial pc(USBTX,USBRX);//allows communication through the USB +AnalogIn range(p19); +float height; +float rv; +float dh; +float ds; +float er; +float k=0.15; +Motor m(p26, p29, p30); +int main() +{ + + m.speed(0); + while(1){ + rv=range; + height=(-75.7457492123552*pow(rv,2))+(90.6774745565381*rv)+(-4.00358328437282); + pc.printf("%f,%f\n",rv,height); + pc.printf("Enter desired height\n"); + pc.scanf("%f",&dh); + er=dh-height; + ds=k*er; + m.speed(ds); + + + + } + } \ No newline at end of file
diff -r 000000000000 -r 37a74423d68e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Feb 19 14:31:05 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file