Gerhard Berman / Mbed 2 deprecated prog_pract3_v2

Dependencies:   MODSERIAL QEI mbed HIDScope

Fork of prog_pract3 by Marieke M

Revision:
3:c1ef4d7490c1
Parent:
2:ee821b9bf42b
Child:
4:db3e61625e18
--- a/main.cpp	Mon Oct 10 13:11:05 2016 +0000
+++ b/main.cpp	Mon Oct 10 13:46:38 2016 +0000
@@ -6,8 +6,8 @@
 DigitalOut led2 (D10);
 AnalogIn potMeterIn(PTB2);
 DigitalIn button1(D7);
-DigitalOut motor1DirectionPin(D4);
-PwmOut motor1MagnitudePin(D5);
+DigitalOut motor1DirectionPin(D6);
+PwmOut motor1MagnitudePin(D7);
 
 Serial pc(USBTX,USBRX);
 Ticker MeasureTicker, TimeTracker;
@@ -67,14 +67,13 @@
     float referenceVelocity = GetReferenceVelocity();
     float motorValue = FeedForwardControl(referenceVelocity);
     SetMotor1(motorValue);
+    pc.printf("MotorValue: %f rad/s \r\n", motorValue);
 }
 
 void TimeTrackerF(){
      wait(1);   
      float Potmeter = potMeterIn.read();
-     float motorValue; 
      pc.printf("Reference velocity: %f rad/s \r\n", referenceVelocity);
-     pc.printf("MotorValue: %f rad/s \r\n", motorValue);
      pc.printf("Potmeter: %f rad/s \r\n", Potmeter);
 }
 
@@ -84,12 +83,10 @@
  led1=0;
  led2=0;
  float Potmeter = potMeterIn.read();
- float motorValue; 
  MeasureTicker.attach(&MeasureTicker_act, 0.01f); 
  TimeTracker.attach(&TimeTracker_act, 0.1f);
  pc.baud(115200);  
  pc.printf("Reference velocity: %f rad/s \r\n", referenceVelocity);
- pc.printf("MotorValue: %f rad/s \r\n", motorValue);
  pc.printf("Potmeter: %f rad/s \r\n", Potmeter);
  
  while(1)