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
source/StartUp.cpp
- Committer:
- aeschsim
- Date:
- 2017-05-16
- Revision:
- 136:b35f2d9b7402
- Parent:
- 133:0046d2224e39
File content as of revision 136:b35f2d9b7402:
#include "StartUp.h"
bool stb = false;
bool stb2 = false;
bool stb3 = false;
bool printf_state = 0;
int idle()
{
if(printf_state == 0) printf("idle1...\r\n"); printf_state = 1;
if(get_user() == false && stb) {
printf_state = 0;
return 15; // button pressed
} else {
stb = true;
return 10;
}
}
int idle2()
{
if(printf_state == 0) printf("idle2...\r\n"); printf_state = 1;
if(get_user() == false && stb2) {
printf_state = 0;
return 25;
} else {
stb2 = true;
wait_ms(100);
return 11;
}
}
int initialisation()
{
Robot_init_all();
return 16;
}
int inital_arm_positioning()
{
open_grabber();
if(arm_position_release()) {
return 11;
}
return 16;
}
int initial_turn()
{
if(stb3 == false) {
stb3 = true;
printf("initial turn...\r\n");
turn_for_deg(180,1);
} else {
//printf("turning...\r\n");
if(turn_for_deg(0,1) < 0) { // check if turning complete
// printf("turn finished...\r\n");
//print_map(0);
return 47;
}
}
return 28;
}
