First release.
Dependencies: FXOS8700CQ SDFileSystem mbed
Final program
- Controling a robot by Bluetooth, it is capable of making 90° turns and move pre-defined distances.
Code by:
- Mayumi Hori
- Sarahí Morán
- Gerardo Carmona
Revision 5:b384cf06de76, committed 2014-11-07
- Comitter:
- gerardo_carmona
- Date:
- Fri Nov 07 05:12:50 2014 +0000
- Parent:
- 4:c60636c95b80
- Commit message:
- Not finished!
Changed in this revision
diff -r c60636c95b80 -r b384cf06de76 main.cpp --- a/main.cpp Fri Oct 17 09:08:06 2014 +0000 +++ b/main.cpp Fri Nov 07 05:12:50 2014 +0000 @@ -55,7 +55,6 @@ #include "mbed.h" #include "motors.h" #include "magnometer.h" -#include "encoder.h" #include "sd_card.h" #include "xbee.h" #include "encoders.h" @@ -132,7 +131,7 @@ c = bt.getc(); bt.printf("%c\n\r", c); //} - //if (c != ' '){ + //if (c != '\n'){ command_bt(c); } } @@ -182,17 +181,17 @@ send_all_data(); break; default: - motor_stop(); + //motor_stop(); // bt.printf("%f\r\n", get_mag_angle()); break; } } void send_all_data(){ - bt.printf("sending all data...\n"); - bt.printf("Right encoder: %f cms\tLeft encoder: %f cms\n", encoder(encoder_rigth), encoder(encoder_rigth)); - bt.printf("Rigt distance: %fcms\tLeft distance: %fcms\n", ultrasonicos(ULTRA_R), ultrasonicos(ULTRA_L)); - bt.printf("Angle: %f\n", get_mag_angle()); + pc.printf("sending all data...\r\n"); + pc.printf("Right encoder: %f cms\tLeft encoder: %f cms\r\n", encoder(encoder_rigth), encoder(encoder_rigth)); + pc.printf("Rigt distance: %fcms\tLeft distance: %fcms\r\n", ultrasonicos(ULTRA_R), ultrasonicos(ULTRA_L)); + pc.printf("Angle: %f\r\n", get_mag_angle()); } void gps_data(){
diff -r c60636c95b80 -r b384cf06de76 my_libraries/encoder.cpp --- a/my_libraries/encoder.cpp Fri Oct 17 09:08:06 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -// ----- Libraries ------------------------------------------------------------------ -#include "mbed.h" -#include "encoder.h" - -// ----- Constants ------------------------------------------------------------------ - - -// ----- I/O Pins ------------------------------------------------------------------- - - -// ----- Others --------------------------------------------------------------------- - - -// ----- Variables ------------------------------------------------------------------ - - -// ----- Functions ------------------------------------------------------------------ -
diff -r c60636c95b80 -r b384cf06de76 my_libraries/encoder.h --- a/my_libraries/encoder.h Fri Oct 17 09:08:06 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -// PARA EL HEADER -#ifndef encoder_h -#define encoder_h - -#endif \ No newline at end of file
diff -r c60636c95b80 -r b384cf06de76 my_libraries/motors.cpp --- a/my_libraries/motors.cpp Fri Oct 17 09:08:06 2014 +0000 +++ b/my_libraries/motors.cpp Fri Nov 07 05:12:50 2014 +0000 @@ -4,8 +4,8 @@ // ----- I/O Pins ------------------------------------------------------------------- // MOTORS (Control) -DigitalOut dir_left(D7); -DigitalOut dir_right(D8); +DigitalOut dir_left(D5); +DigitalOut dir_right(D6); PwmOut pwm_left(D9); PwmOut pwm_right(D10);