![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Random walk for psiSwarm
Dependencies: PsiSwarmV8_CPP mbed
Fork of PsiSwarm_V8_Blank_CPP by
Diff: main.cpp
- Revision:
- 0:9c0ccd879613
- Child:
- 2:5d37e5fd7141
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Oct 15 13:52:26 2016 +0000 @@ -0,0 +1,76 @@ +/*********************************************************************** +** ██████╗ ███████╗██╗███████╗██╗ ██╗ █████╗ ██████╗ ███╗ ███╗ ** +** ██╔══██╗██╔════╝██║██╔════╝██║ ██║██╔══██╗██╔══██╗████╗ ████║ ** +** ██████╔╝███████╗██║███████╗██║ █╗ ██║███████║██████╔╝██╔████╔██║ ** +** ██╔═══╝ ╚════██║██║╚════██║██║███╗██║██╔══██║██╔══██╗██║╚██╔╝██║ ** +** ██║ ███████║██║███████║╚███╔███╔╝██║ ██║██║ ██║██║ ╚═╝ ██║ ** +** ╚═╝ ╚══════╝╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ** +************************************************************************ +** Copyright 2016 University of York ** +** ** +** Licensed under the Apache License, Version 2.0 (the "License") ** +** You may not use this file except in compliance with the License. ** +** You may obtain a copy of the License at ** +** http://www.apache.org/licenses/LICENSE-2.0 Unless required by ** +** applicable law or agreed to in writing, software distributed under ** +** under the License is distributed on an "AS IS" BASIS WITHOUT ** +** WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** +** See the License for the specific language governing permissions ** +** and limitations under the License. ** +***********************************************************************/ + +/// PsiSwarm Blank Example Code +/// Version 0.7 +/// James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis +/// University of York + +/// Include main.h - this includes psiswarm.h all the other necessary core files +#include "main.h" + +char * program_name = "Blank"; +char * author_name = "YRL"; +char * version_name = "0.41"; + +void user_code_loop() +{ + wait(1); +} + +///Place user code here that should be run after initialisation but before the main loop +void user_code_setup() +{ + wait(1); + display.clear_display(); + display.set_position(0,0); + display.write_string("No Code"); +} + +/// Code goes here to handle what should happen when the user switch is pressed +void handle_switch_event(char switch_state) +{ + /// Switch_state = 1 if up is pressed, 2 if down is pressed, 4 if left is pressed, 8 if right is pressed and 16 if the center button is pressed + /// NB For maximum compatability it is recommended to minimise reliance on center button press + +} + +void handle_user_serial_message(char * message, char length, char interface) +{ + // This is where user code for handling a (non-system) serial message should go + // + // message = pointer to message char array + // length = length of message + // interface = 0 for PC serial connection, 1 for Bluetooth + +} + +/// The main routine: it is recommended to leave this function alone and add user code to the above functions +int main() +{ + ///init() in psiswarm.cpp sets up the robot + init(); + user_code_setup(); + user_code_running = 1; + while(1) { + user_code_loop(); + } +} \ No newline at end of file