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: QEI
Revision 1:f0e6a1eb94a8, committed 2022-04-27
- Comitter:
- okadaya
- Date:
- Wed Apr 27 03:39:55 2022 +0000
- Parent:
- 0:ca2a77886231
- Commit message:
- encorder_moter
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r ca2a77886231 -r f0e6a1eb94a8 main.cpp
--- a/main.cpp Wed Jun 23 08:34:39 2021 +0000
+++ b/main.cpp Wed Apr 27 03:39:55 2022 +0000
@@ -8,8 +8,6 @@
#include "QEI.h"
Serial pc(USBTX, USBRX, 115200);
Serial md(PC_10, PC_11, 38400);
-PwmOut motor1(PF_8);
-PwmOut motor2(PF_7);
// Blinking rate in milliseconds
#define BLINKING_RATE_MS 500
#define ROTATE_PER_REVOLUTIONS 64 //For QEI's pulse data
@@ -40,15 +38,15 @@
pc.printf("%d",kai);
pc.printf("Pulses: %07d", wheel.getPulses());
pc.printf("Rotate: %d\n", (int)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4));
- if((int)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4)<100&&kai==0){
- moter(64);
+ if((int)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4)<10&&kai==0){
+ moter(48);
pc.printf("a");
- if((int)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4)==99){
+ if((int)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4)==9){
kai=1;
}
}
if((int)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4)>0&&kai==1){
- moter(-64);
+ moter(-48);
pc.printf("b");
if((int)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4)==1){
kai=0;