2 Motores + Joystick
Dependencies: X_NUCLEO_IHM01A1 TextLCD
Fork of HelloWorld_IHM01A1_2Motors_mbedOS by
Revision 38:c3d77ff8168a, committed 2018-04-25
- Comitter:
- leogrotti
- Date:
- Wed Apr 25 15:03:09 2018 +0000
- Parent:
- 37:d5d1468f1dd2
- Child:
- 39:7e30bcc989d3
- Commit message:
- 2 motores config + joystick funcionando
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Apr 25 14:28:04 2018 +0000
+++ b/main.cpp Wed Apr 25 15:03:09 2018 +0000
@@ -107,7 +107,7 @@
float w;
float u;
-float a;
+//float a;
@@ -117,15 +117,15 @@
unsigned int speed1;
unsigned int speed2;
-unsigned int speed3;
+//unsigned int speed3;
-unsigned int pos3;
+//unsigned int pos3;
/* Motor Control Component. */
L6474 *motor1;
L6474 *motor2;
-L6474 *motor3;
+//L6474 *motor3;
/* Main ----------------------------------------------------------------------*/
@@ -140,16 +140,16 @@
/* Initializing Motor Control Components. */
motor1 = new L6474(D2, D8, D7, D9, D10, dev_spi);
motor2 = new L6474(D2, D8, D4, D3, D10, dev_spi);
- motor3 = new L6474(D2, D8, D5, D6, D10, dev_spi);
+ // motor3 = new L6474(D2, D8, D5, D6, D10, dev_spi);
if (motor1->init() != COMPONENT_OK) {
exit(EXIT_FAILURE);
}
if (motor2->init() != COMPONENT_OK) {
exit(EXIT_FAILURE);
}
- if (motor3->init() != COMPONENT_OK) {
- exit(EXIT_FAILURE);
- }
+ // if (motor3->init() != COMPONENT_OK) {
+ // exit(EXIT_FAILURE);
+ // }
@@ -182,8 +182,8 @@
motor1->run(StepperMotor::FWD);
speed1 = motor1->get_speed();
- //printf("speed1 =%d \r\n\n", speed1);
- //printf("U =%f \r\n\n", u);
+ printf("speed1 =%d \r\n\n", speed1);
+ printf("U =%f \r\n\n", u);
}
else{ if(u<0.65) {
@@ -191,17 +191,17 @@
motor1->run(StepperMotor::BWD);
speed1 = motor1->get_speed();
- //printf("speed1 =%d \r\n\n", speed1);
+ printf("speed1 =%d \r\n\n", speed1);
- // printf("U =%f \r\n\n", u);
+ printf("U =%f \r\n\n", u);
}
else
motor1->hard_stop();
speed1 = 0;
- //printf("speed1 =%d \r\n\n", speed1);
+ printf("speed1 =%d \r\n\n", speed1);
- // printf("U =%f \r\n\n", u);
+ printf("U =%f \r\n\n", u);
}
@@ -210,8 +210,8 @@
motor2->run(StepperMotor::BWD);
speed2 = motor2->get_speed();
- //printf("speed2 =%d \r\n\n", speed2);
- //printf("W =%f \r\n\n", w);
+ printf("speed2 =%d \r\n\n", speed2);
+ printf("W =%f \r\n\n", w);
}
else{ if(w<0.67) {
@@ -220,15 +220,15 @@
motor2->run(StepperMotor::FWD);
speed2 = motor2->get_speed();
- // printf("speed2 =%d \r\n\n", speed2);
- // printf("W =%f \r\n\n", w);
+ printf("speed2 =%d \r\n\n", speed2);
+ printf("W =%f \r\n\n", w);
}
else
motor2->hard_stop();
speed2 = 0;
- // printf("speed2 =%d \r\n\n", speed2);
- //printf("W =%f \r\n\n", w);
+ printf("speed2 =%d \r\n\n", speed2);
+ printf("W =%f \r\n\n", w);
}
