elevator
/
Elevator_movement_proportional
proportional
main.cpp
- Committer:
- Ty
- Date:
- 2015-02-19
- Revision:
- 0:37a74423d68e
File content as of revision 0:37a74423d68e:
#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); } }