Demonstration of RPCVariables to implement closed loop control in LabVIEW of a motor using a QEI for feedback
Diff: main.cpp
- Revision:
- 2:439a3a118526
- Parent:
- 0:839ba4bb1be1
--- 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