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.
main.cpp
- Committer:
- angel123
- Date:
- 2018-09-11
- Revision:
- 2:3007b3c06d2c
- Parent:
- 1:526bdd5faa37
- Child:
- 6:8d7f6fe73ed1
File content as of revision 2:3007b3c06d2c:
#include "mbed.h"
#include "main.h"
Serial command(USBTX, USBRX);
int main() {
init_servo();
init_serial();
debug_m("inicio \n");
uint32_t read_cc;
while(1)
{
read_cc=read_command();
switch (read_cc)
{
case 0x01: moving();
break;
default: debug_m("error de comando.\n");
break ;
}
}
}
uint32_t read_command()
{
char intc=command.getc();
while(intc != 0xff)
intc=command.getc();
return command.getc();
}
void init_serial()
{
command.baud(9600);
}
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");
}
void debug_m(char *s , ... ){
#if DEBUG
command.printf(s);
#endif
}