Demonstration of RPCVariables to implement closed loop control in LabVIEW of a motor using a QEI for feedback
Revision 2:439a3a118526, committed 2010-09-21
- Comitter:
- MichaelW
- Date:
- Tue Sep 21 16:00:43 2010 +0000
- Parent:
- 1:c04c66626d93
- Commit message:
Changed in this revision
RPCInterface.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c04c66626d93 -r 439a3a118526 RPCInterface.lib --- a/RPCInterface.lib Mon Sep 20 14:48:02 2010 +0000 +++ b/RPCInterface.lib Tue Sep 21 16:00:43 2010 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/MichaelW/code/RPCInterface/#9232f9e1178d +http://mbed.org/users/MichaelW/code/RPCInterface/#682c65afe534
diff -r c04c66626d93 -r 439a3a118526 main.cpp --- a/main.cpp Mon Sep 20 14:48:02 2010 +0000 +++ b/main.cpp Tue Sep 21 16:00:43 2010 +0000 @@ -1,3 +1,8 @@ +/** +* Copyright (c)2010 ARM Ltd. +* Released under the MIT License: http://mbed.org/license/mit +*/ + #include "mbed.h" #include "QEI.h" #include "Motor.h" @@ -23,14 +28,10 @@ float NoPulses; while(1){ - //This code writes the value of MotorOutput to the Motor and reads the number of pulses into the percentage. - - NoPulses = Encoder.getPulses(); + NoPulses = Encoder.getPulses(); Percentage = ((NoPulses / 48) * 100); - - //RPC will be used to set the value of MotorOut. + //RPC will be used to set the value of MotorOutput. Wheel.speed((MotorOutput - 50) * 2 / 100); - wait(0.005); } } \ No newline at end of file