
ft. button press reset
Dependencies: mbed
Fork of BeaconDemo_RobotCodeNew by
Diff: main.cpp
- Revision:
- 12:daa53285b6e4
- Parent:
- 11:7b3ee540ba56
- Child:
- 13:f5994956b1ba
--- a/main.cpp Tue Oct 27 00:13:49 2015 +0000 +++ b/main.cpp Tue Oct 27 13:03:10 2015 +0000 @@ -33,12 +33,13 @@ unsigned short reflected_sensor_data[8]; // The reflected IR values when this robots emitters are on unsigned short background_sensor_data[8];// The raw IR values when no robot (or beacon) should have its IR on -char default_normal_program = 3; // The program to run on turn on (after 'face beacon' program) +char default_normal_program = 6; // The program to run on turn on (after 'face beacon' program) char use_recharging_program = 1; // Set to 1 to force robot to run recharging program when battery voltage drops below a threshold char user_code_debug = 1; // Set to 1 to show terminal messages from "out" function [specific to this code] char display_debug_inf = 0; // Set to 1 to show debug info about beacon\robots on display [instead of running program info] char main_program_state; // Index of the currently running program char program_changed = 0; // Flag to update display when program is changed +char program_run_init = 0; // Flag to tell program to run its initialisation on first loop, if neccessary char success_count = 0; // Flag to indicate the success of a program char step_cycle = 0; // Alternates between 0 and 1 in successive time-steps char target_reached = 0; // Flag to indicate if a program target has been reached @@ -87,6 +88,9 @@ case 5: find_space_program(); break; + case 6: + clustering_program(0); + break; } } step_cycle=1-step_cycle; @@ -94,7 +98,7 @@ ///Place user code here that should be run after initialisation but before the main loop void user_code_setup() -{ +{ wait(0.8); display.clear_display(); display.set_position(0,0); @@ -167,6 +171,9 @@ case 5: strcpy(ret_name,"FIND SPACE"); break; + case 6: + strcpy(ret_name,"CLUSTERING"); + break; } return ret_name; } @@ -175,6 +182,7 @@ { main_program_state = index; program_changed = 1; + program_run_init = 1; strcpy(prog_info,""); strcpy(prog_name,get_program_name(index)); }