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.
Fork of Nucleo_CaitSith_Firmware by
Diff: main.cpp
- Revision:
- 7:3fcb0d1c41aa
- Parent:
- 6:a3829299dfd5
- Child:
- 8:857b3285dc79
--- a/main.cpp Sat Feb 28 12:02:38 2015 +0000
+++ b/main.cpp Sat Mar 07 15:49:55 2015 +0000
@@ -47,16 +47,19 @@
//SendData::SendData *data = new SendData(0, 0);
//base.set(*data);
+ int timecount = 0;
while(1) {
char buffer[BUFFER_SIZE];
int size = serial_gets(buffer, BUFFER_SIZE);
if (size > 0) {
control_caitsith(buffer, size);
}
- //pc.printf("[%x, %x]", data.wheelVelocity[0], data.wheelVelocity[1]);
-
- base.periodicCallback();//ルンバへ移動指示
- wait_ms(100);//millis
+ if (timecount >= 10000) {
+ base.periodicCallback();//ルンバへ移動指示
+ timecount = 0;
+ }
+ timecount++;
+ wait_us(10);
}
}
@@ -64,7 +67,7 @@
//bool
void control_caitsith(char* buffer, int size) {
#ifdef DEBUG
- //pc.printf("%s", buffer);
+ pc.printf("%s", buffer);
#endif
// コマンド判定
if (strncmp(buffer, "CT", 2) == 0) {
@@ -277,7 +280,8 @@
//pc.printf("%c", buffer[i]);
if (buffer[i] == '\r') {
- --i;
+ //--i;
+ break;
}
if (buffer[i] == '\n') {
