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: main.cpp
- Revision:
- 0:17d76ace37b6
diff -r 000000000000 -r 17d76ace37b6 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Mar 06 17:20:00 2015 +0000
@@ -0,0 +1,113 @@
+// main.cpp -----------------------------------------
+#include "mbed.h"
+#include "motorControl.h"
+
+DigitalIn Motor1A(p10);
+DigitalIn Motor1B(p25);
+
+DigitalIn Motor2A(p13);
+DigitalIn Motor2B(p23);
+
+DigitalIn Motor3A(p12);
+DigitalIn Motor3B(p24);
+
+DigitalIn Motor4A(p11);
+DigitalIn Motor4B(p26);
+
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+#define MTR1A 0
+#define MTR1B 1
+#define MTR2A 2
+#define MTR2B 3
+#define MTR3A 4
+#define MTR3B 5
+#define MTR4A 6
+#define MTR4B 7
+
+int mtrCounts[4];
+
+int flagMotor1A = 0;
+int flagMotor2A = 0;
+int flagMotor3A = 0;
+int flagMotor4A = 0;
+
+int warmUpNeeded = 0;
+int repeatFlag = 1;
+
+Timer timer1;
+Timer timer2;
+
+int main()
+{ /*
+ stopMotors();
+ wait(10);
+ */
+ while(1){
+ stopMotors1();
+ }/*
+ if(warmUpNeeded < 4 && repeatFlag == 1){
+ warmUpNeeded = warmUpNeeded + warmupStart();
+ timer1.start();
+ repeatFlag = 0;
+ }
+ if(0.95 < timer1.read() && timer1.read() < 1.05){
+ stopMotors();
+ wait(1);
+ timer1.reset();
+ timer1.start();
+ recordMotorCounts(&mtrCounts[0]);
+ repeatFlag = 1;
+ }
+ if(warmUpNeeded == 4 && repeatFlag == 1){
+ exponentialAccAndDecCurves();
+ warmUpNeeded = 10000;
+ }
+
+ if(Motor1A == 0 && flagMotor1A == 1){
+ mtrCounts[0]++;
+ flagMotor1A = 0;
+ }
+ if(Motor1A == 1 && flagMotor1A == 0){
+ mtrCounts[0]++;
+ flagMotor1A = 1;
+ }
+
+ if(Motor2A == 0 && flagMotor2A == 1){
+ mtrCounts[1]++;
+ flagMotor2A = 0;
+ }
+ if(Motor2A == 1 && flagMotor2A == 0){
+ mtrCounts[1]++;
+ flagMotor2A = 1;
+ }
+
+ if(Motor3A == 0 && flagMotor3A == 1){
+ mtrCounts[2]++;
+ flagMotor3A = 0;
+ }
+ if(Motor3A == 1 && flagMotor3A == 0){
+ mtrCounts[2]++;
+ flagMotor3A = 1;
+ }
+
+ if(Motor4A == 0 && flagMotor4A == 1){
+ mtrCounts[3]++;
+ flagMotor4A = 0;
+ }
+ if(Motor4A == 1 && flagMotor4A == 0){
+ mtrCounts[3]++;
+ flagMotor4A = 1;
+ }
+ } */
+}
+
+
+
+
+
+
+
+
+