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:
- 2:fda902bed8c6
- Parent:
- 1:b473a0ad2b83
- Child:
- 3:ed8f41c75a80
--- a/main.cpp Fri Feb 22 13:10:24 2019 +0000
+++ b/main.cpp Fri Feb 22 13:28:24 2019 +0000
@@ -5,7 +5,7 @@
por medio de la comunicacion serial donde el comando sea
| | | |
-| init_commd | N_motor | N_grados |
+| INITCMD | N_motor | N_grados |
| 0xff | 0x01- 0x04 | 0x00 - 0xb4 |
para enviar los comandos usar el programa Coolterm
@@ -16,12 +16,12 @@
PwmOut myservo1(PB_4);
/*INGRESE L A CONFIGURACION DE LOS MOTORES*/
-
+#define INITCMD 0xFF
// definición de las variables globales
-uint8_t nm; // almacena el número de motor
-uint8_t ng; // almacena los grados que se mueve el motor
+uint8_t N_motor; // almacena el número de motor
+uint8_t N_grados; // almacena los grados que se mueve el motor
void setup_uart();
@@ -35,7 +35,7 @@
setup_servo();
while(1){
leer_datos();
- mover_servo(nm, ng);
+ mover_servo(N_motor, N_grados);
}
}
@@ -51,9 +51,9 @@
}
void leer_datos(){
- while(command.getc()!= 0xff);
- nm=command.getc();
- ng=command.getc();
+ while(command.getc()!= INITCMD);
+ N_motor=command.getc();
+ N_grados=command.getc();
}