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: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Revision 5:9ebcbd39ec3f, committed 2019-09-20
- Comitter:
- MarliesWeggemans
- Date:
- Fri Sep 20 09:01:04 2019 +0000
- Parent:
- 4:3e9a8f5d9a1a
- Commit message:
- HoekbepalenPulsesMotor
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Sep 20 08:35:52 2019 +0000
+++ b/main.cpp Fri Sep 20 09:01:04 2019 +0000
@@ -7,15 +7,15 @@
Serial pc(USBTX,USBRX);
FastPWM led(PTA2);
+// QEI (PinName channelA, PinName channelB, PinName index, int pulsesPerRev, Encoding encoding=X2_ENCODING)
+int pulses = 624;
+QEI wheel (D13,D12,NC, pulses);
-float ledb = 0.5f;
+// float ledb = 0.5f;
int main(){
- printf("Controll with dial\n");
- led.period(0.01f) ;
- led.write(0.5f) ;
- while(true){
- wait(0.01);
- pc.printf("analog input is (%f)\n\r",pot.read()); wait(0.1);
- led.write(pot);
- }
+ while(1){
+ wait(0.1);
+ pc.printf("Pulses is: %i\n", wheel.getPulses());
+ }
+
}