Blank program code for the Psi Swarm robot using the C++ API variant (version 0.8)

Dependencies:   PsiSwarmV8_CPP mbed

Fork of PsiSwarm_V7_Blank by Psi Swarm Robot

Files at this revision

API Documentation at this revision

Comitter:
jah128
Date:
Mon Oct 17 13:20:23 2016 +0000
Parent:
1:42127e513cbf
Commit message:
Updated copyright message

Changed in this revision

PsiSwarmV8_CPP.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
--- a/PsiSwarmV8_CPP.lib	Sun Oct 16 16:04:15 2016 +0000
+++ b/PsiSwarmV8_CPP.lib	Mon Oct 17 13:20:23 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/Psi-Swarm-Robot/code/PsiSwarmV8_CPP/#e58323951c08
+https://developer.mbed.org/teams/Psi-Swarm-Robot/code/PsiSwarmV8_CPP/#adbd827234a4
--- a/main.cpp	Sun Oct 16 16:04:15 2016 +0000
+++ b/main.cpp	Mon Oct 17 13:20:23 2016 +0000
@@ -6,34 +6,27 @@
 **  ██║     ███████║██║███████║╚███╔███╔╝██║  ██║██║  ██║██║ ╚═╝ ██║  **
 **  ╚═╝     ╚══════╝╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝  **
 ************************************************************************
-** 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.                                 **
+** Copyright 2016 University of York - See notice at end of file      **
 ***********************************************************************/
 
-/// PsiSwarm Blank Example Code
-/// Version 0.7
+/// PsiSwarm C++ Blank Example Code - Version 0.8
 /// 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"
 
+Psiswarm psi;
+
 char * program_name = "Blank";
 char * author_name  = "YRL";
-char * version_name = "0.41";
+char * version_name = "0.80";
 
+///User code loop:  This is where user code should go; it is run as an infinite loop
 void user_code_loop()
 {
-    wait(1);   
+    // Example:
+    // animations.led_run1();
+    // wait(1.2);   
 }
 
 ///Place user code here that should be run after initialisation but before the main loop
@@ -50,7 +43,6 @@
 {
     /// 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)
@@ -60,17 +52,30 @@
     // 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;
+    psi.init();             ///psi.init() in psiswarm.cpp sets up the robot
+    user_code_setup();      ///run user code setup block
+    user_code_running = 1;  ///nb. user code can be paused by external commands sent from PC\BT interfaces
     while(1) {
-        user_code_loop();
+        user_code_loop();   ///run user code
     }
-}
\ No newline at end of file
+}
+
+
+/***********************************************************************
+** 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.                                 **
+***********************************************************************/
\ No newline at end of file
--- a/main.h	Sun Oct 16 16:04:15 2016 +0000
+++ b/main.h	Mon Oct 17 13:20:23 2016 +0000
@@ -20,7 +20,7 @@
 ***********************************************************************/
 
 /// PsiSwarm Blank Example Code
-/// Version 0.7
+/// Version 0.8
 /// James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis
 /// University of York