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: MODSERIAL QEI mbed-dsp mbed
Fork of PI_controller_verbeteringen by
Revision 6:1ee8795b7578, committed 2018-09-24
- Comitter:
- SimonRez
- Date:
- Mon Sep 24 14:20:04 2018 +0000
- Parent:
- 5:f07bafaf11d7
- Child:
- 7:e21056555296
- Commit message:
- Potmeter met encoder;
Changed in this revision
| QEI.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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QEI.lib Mon Sep 24 14:20:04 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/aberk/code/QEI/#5c2ad81551aa
--- a/main.cpp Mon Sep 24 14:15:12 2018 +0000
+++ b/main.cpp Mon Sep 24 14:20:04 2018 +0000
@@ -1,5 +1,6 @@
#include "mbed.h"
#include "MODSERIAL.h"
+#include "QEI.h"
Ticker Blinker;
@@ -9,7 +10,9 @@
PwmOut pwmpin(PTA2);
DigitalOut direct(PTB23);
-AnalogIn enc1(A0);
+AnalogIn pot1(A0);
+
+QEI encoder(D12,D13,NC,32);
InterruptIn sw2(SW2);
InterruptIn sw3(SW3);
@@ -30,9 +33,9 @@
while (true)
{
- pwmpin.write(enc1.read());
+ pwmpin.write(pot1.read());
direct = 1;
- pc.printf("%f \r\n", enc1.read());
+ pc.printf("potmeter: %f, encoder: %i \r\n", pot1.read(), encoder.getPulses());
wait(0.2f);
}
}
