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:3007b3c06d2c
- Parent:
- 1:526bdd5faa37
- Child:
- 6:8d7f6fe73ed1
diff -r 526bdd5faa37 -r 3007b3c06d2c main.cpp
--- a/main.cpp Tue Sep 04 02:15:49 2018 +0000
+++ b/main.cpp Tue Sep 11 01:27:25 2018 +0000
@@ -1,14 +1,8 @@
#include "mbed.h"
-
#include "main.h"
-
-
-
Serial command(USBTX, USBRX);
-
-
int main() {
init_servo();
init_serial();
@@ -18,9 +12,14 @@
while(1)
{
read_cc=read_command();
- switch (read_cc) {
- case 0x01: moving(); break;
- default: debug_m("error de comando. \nSe espera 0xFEF0 o 0xFFF0 \n");break ;
+
+ switch (read_cc)
+ {
+ case 0x01: moving();
+ break;
+
+ default: debug_m("error de comando.\n");
+ break ;
}
}
}
@@ -29,15 +28,11 @@
uint32_t read_command()
{
- // retorna los byte recibidos concatenados en un entero,
-
-
-
char intc=command.getc();
- while(intc != '<')
+ while(intc != 0xff)
intc=command.getc();
- return intc;
+ return command.getc();
}
@@ -47,15 +42,14 @@
}
-void moving(){
+void moving()
+{
debug_m("se inicia el comado mover..\n");
-
char nmotor=command.getc();
char grados=command.getc();
char endc=command.getc();
mover_ser(nmotor,grados);
- debug_m("fin del comado guardar..\n");
-
+ debug_m("fin del comado guardar..\n");
}
void debug_m(char *s , ... ){