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 19:79600d3509d7, committed 2016-05-03
- Comitter:
- mjhaugsdal
- Date:
- Tue May 03 12:27:31 2016 +0000
- Parent:
- 18:ef02a9014491
- Child:
- 20:d90bd1718078
- Commit message:
- Testing for prototype. Streamlined keys to fit the keypad on the keyboard.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Apr 26 14:29:08 2016 +0000
+++ b/main.cpp Tue May 03 12:27:31 2016 +0000
@@ -261,6 +261,56 @@
wait_us(fart);
}
+void stepEngine3Right()
+{
+ //engine 1
+ IN9=0;
+ IN10=1;
+ IN11=0;
+ IN12=1;
+ wait_us(fart);
+ IN9=0;
+ IN10=1;
+ IN11=1;
+ IN12=0;
+ wait_us(fart);
+ IN9=1;
+ IN10=0;
+ IN11=1;
+ IN12=0;
+ wait_us(fart);
+ IN9=1;
+ IN10=0;
+ IN11=0;
+ IN12=1;
+ wait_us(fart);
+}
+
+void stepEngine3Left()
+{
+ //engine 1
+ IN9=1;
+ IN10=0;
+ IN11=0;
+ IN12=1;
+ wait_us(fart);
+ IN9=1;
+ IN10=0;
+ IN11=1;
+ IN12=0;
+ wait_us(fart);
+ IN9=0;
+ IN10=1;
+ IN11=1;
+ IN12=0;
+ wait_us(fart);
+ IN9=0;
+ IN10=1;
+ IN11=0;
+ IN12=1;
+ wait_us(fart);
+}
+
void stopAll()
{
IN1=0;
@@ -279,6 +329,8 @@
+
+
void input(void const *args)
{
while(true)
@@ -306,62 +358,11 @@
{
//Thread::wait(5);
-
- if(m_cmd == 't')
- {
- stepAllLeft();
-
- }
- if(m_cmd == 'y')
- {
- stepAllRight();
-
- }
-
-
- //0 STEPS LEFT AT MAX SPEED
- if (m_cmd == '0')
- {
- fart = 1000;
- //global_direction = '0';
- stepAllLeft();
- //steps = steps + step;
-
-
- //printf("LEFT \n");
- //printf("%c \n" + global_direction);
- }
- //1 STEPS RIGHT AT MAX SPEED
- else if (m_cmd == '1')
- {
- fart = 1000;
- //global_direction = '1';
- stepAllRight();
- }
- else
- {
- //global_direction = 'x';
- }
-
- if (m_cmd == 'a')
- {
- fart = 2000;
- //global_direction = '1';
- stepAllRight();
- //steps = steps + step;
- // printf("%i", &steps);
-
- }
+ /*
+
+
- else if (m_cmd == 'c')
- {
- fart = 2000;
- //global_direction = '0';
- stepAllLeft();
-
- //steps = steps + step;
- // printf("%i", &steps);
- }
+
else if (m_cmd == 'k')
{
int steps = 242;
@@ -386,12 +387,50 @@
}
m_cmd = 'x';
- }
+ }*/
if (m_cmd == 'z')
{
stopAll();
+ }
+
+ if (m_cmd == 'x')
+ {
+ Thread::wait(5);
}
-
+
+ //ENGINE 1
+ if(m_cmd == '7')
+ {
+ //fart = 1200;
+ stepEngine1Left();
+ }
+ else if (m_cmd == '9')
+ {
+ //fart = 1200;
+ stepEngine1Right();
+ }
+ //ENGINE 2
+ else if (m_cmd == '4')
+ {
+ //fart = 1200;
+ stepEngine2Left();
+ }
+ else if (m_cmd == '6')
+ {
+ //fart = 1200;
+ stepEngine2Right();
+ }
+ //ENGINE 3
+ else if (m_cmd == '1')
+ {
+ //fart = 1200;
+ stepEngine3Left();
+ }
+ else if (m_cmd == '3')
+ {
+ //fart = 1200;
+ stepEngine3Right();
+ }
