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.
Diff: encoder.cpp
- Revision:
- 0:e180c98a3437
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/encoder.cpp Mon Nov 01 15:39:50 2021 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+#include "QEI.h"
+
+QEI encoder (A0,A1,NC,2500);
+Serial pc(USBTX, USBRX);
+int counter = 0;
+int cur_state = 0;
+
+int main(void) {
+ while(1){
+ counter = counter++;
+ if( counter > cur_state){
+ cur_state = counter;
+ printf("%d ", cur_state);
+ }else if(counter < cur_state){
+ cur_state = counter;
+ printf("%d ", cur_state);
+ }
+ }
+}
\ No newline at end of file