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 demomode
Diff: main.cpp
- Revision:
- 8:b2e57b815f68
- Parent:
- 6:c2608dedfd70
diff -r c2608dedfd70 -r b2e57b815f68 main.cpp
--- a/main.cpp Fri Sep 20 09:41:43 2019 +0000
+++ b/main.cpp Fri Sep 20 10:16:14 2019 +0000
@@ -3,9 +3,10 @@
#include "FastPWM.h" ;
#include "QEI.h";
-AnalogIn pot(PTB2);
Serial pc(USBTX,USBRX);
+// motor control
+AnalogIn pot(PTB2);
FastPWM motor(D5);
// Encoding
@@ -13,12 +14,16 @@
QEI wheel (D13,D12,NC, pulses);
-int main(){
+int main()
+{
while(1){
wait(0.1);
- pc.printf("Pulses is: %i\n", wheel.getPulses());
- printf("motor relative speed is (%f)\n\r",pot.read());
- motor.write(pot);
+ printf("motor relative speed is (%f)\n\r",pot.read());
+ wait(0.1);
+ motor.write(pot);
}
-
- }
\ No newline at end of file
+ while(true){
+ wait(0.1);
+ pc.printf("Pulses is: %i\n", wheel.getPulses());
+ wait(0.1);
+}
\ No newline at end of file