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.
Dependencies: mbed
Fork of Robocode by
Diff: source/StartUp.cpp
- Revision:
- 61:b57577b0072f
- Parent:
- 58:1a395b6928ee
- Child:
- 63:87b615e4a842
--- a/source/StartUp.cpp Tue Apr 18 15:40:21 2017 +0000
+++ b/source/StartUp.cpp Tue Apr 18 16:19:18 2017 +0000
@@ -1,20 +1,28 @@
#include "StartUp.h"
+bool stb = false;
+bool stb2 = false;
+bool stb3 = false;
int idel()
{
- if(get_user()) {
- return 15;
+
+ if(get_user() == false && stb) {
+ return 15; // button pressed
} else {
+ stb = true;
return 10;
}
}
int idel2()
{
- if(get_user()) {
- return 25;
+
+ if(get_user() == false && stb2) {
+ return 25; // button pressed
} else {
+ stb2 = true;
+ wait_ms(100);
return 11;
}
}
@@ -29,13 +37,24 @@
int inital_positioning()
{
-
+ printf("positioning...\r\n");
return 11;
}
int initial_turn()
{
-
- return 0;
+
+ if(stb3 == false) {
+ stb3 = true;
+ printf("initial turn...\r\n");
+ turn_for_deg(180);
+ } else {
+ printf("turning...\r\n");
+ if(1) { // check if turning complete
+ printf("turn finished...\r\n");
+ return 35;
+ }
+ }
+ return 27;
}
