Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HIDScope MODSERIAL QEI mbed
Fork of prog_pract3 by
Diff: main.cpp
- Revision:
- 4:db3e61625e18
- Parent:
- 3:c1ef4d7490c1
- Child:
- 5:1b8032a15afe
--- a/main.cpp Mon Oct 10 13:46:38 2016 +0000
+++ b/main.cpp Mon Oct 10 14:00:30 2016 +0000
@@ -5,9 +5,9 @@
DigitalOut led1 (D12);
DigitalOut led2 (D10);
AnalogIn potMeterIn(PTB2);
-DigitalIn button1(D7);
-DigitalOut motor1DirectionPin(D6);
-PwmOut motor1MagnitudePin(D7);
+DigitalIn button1(D5);
+DigitalOut motor1DirectionPin(D7);
+PwmOut motor1MagnitudePin(D6);
Serial pc(USBTX,USBRX);
Ticker MeasureTicker, TimeTracker;
@@ -27,13 +27,13 @@
if (button1 == 0){
led1=1;
led2=0;
- // Clockwise rotation
+ // Counterclockwise rotation
referenceVelocity = potMeterIn * maxVelocity;
}
else {
led1=0;
led2=1;
- // Counterclockwise rotation
+ // Clockwise rotation
referenceVelocity = -1*potMeterIn * maxVelocity;
}
return referenceVelocity;
@@ -84,7 +84,7 @@
led2=0;
float Potmeter = potMeterIn.read();
MeasureTicker.attach(&MeasureTicker_act, 0.01f);
- TimeTracker.attach(&TimeTracker_act, 0.1f);
+ TimeTracker.attach(&TimeTracker_act, 0.3f);
pc.baud(115200);
pc.printf("Reference velocity: %f rad/s \r\n", referenceVelocity);
pc.printf("Potmeter: %f rad/s \r\n", Potmeter);
