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-rtos mbed PinDetect
Fork of FinalMotorControl by
Revision 22:f6e328f7bd28, committed 2016-05-05
- Comitter:
- mjhaugsdal
- Date:
- Thu May 05 09:24:43 2016 +0000
- Parent:
- 21:9f3ae352ee63
- Child:
- 23:ad08a8eabc24
- Commit message:
- Making a commit before testing a way to put wait in its own method
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue May 03 13:25:25 2016 +0000
+++ b/main.cpp Thu May 05 09:24:43 2016 +0000
@@ -21,7 +21,7 @@
DigitalOut IN12(D11);
-static int fart = 1000;
+static int fart = 1300;
static char m_cmd = 'x';
@@ -368,7 +368,7 @@
}
- Thread::wait(10);
+ Thread::wait(20);
//pc.printf("%d", steps);
}
}
@@ -377,19 +377,31 @@
{
//Thread 1 has constant feed from usb
Thread t1(input);
- static char global_direction;
+ //static char global_direction;
printf("Started");
+ /*
+
+ BOOT UP AND SYNCHRONIZE
+
+ */
+
+
while (true)
- {
- //Thread::wait(5);
+ {
+ if(m_cmd == 'a')
+ {
+ stepAllRight();
+ }
+
+ else if (m_cmd == 'b')
+ {
+ stepAllLeft();
+
+ }
/*
-
-
-
-
else if (m_cmd == 'k')
{
int steps = 242;
@@ -424,46 +436,45 @@
//Make all engines halt and hold still.
if (m_cmd == 'x')
{
- Thread::wait(5);
}
//Controlling each motor seperately.
//ENGINE 1
if(m_cmd == '7')
{
- //fart = 1200;
+
stopE1();
stepEngine1Left();
}
else if (m_cmd == '9')
{
- //fart = 1200;
+
stopE1();
stepEngine1Right();
}
//ENGINE 2
else if (m_cmd == '4')
{
- //fart = 1200;
+
stopE2();
stepEngine2Left();
}
else if (m_cmd == '6')
{
- //fart = 1200;
+
stopE2();
stepEngine2Right();
}
//ENGINE 3
else if (m_cmd == '1')
{
- //fart = 1200;
+
stopE3();
stepEngine3Left();
}
else if (m_cmd == '3')
{
- //fart = 1200;
+
stopE3();
stepEngine3Right();
}
