YRL Maze lab made more script-y
Dependencies: PsiSwarmLab-ScriptingBased mbed
Fork of UKESF_Lab by
main.cpp@32:cdcc91651e55, 2018-09-14 (annotated)
- Committer:
- YRL50
- Date:
- Fri Sep 14 16:01:22 2018 +0000
- Revision:
- 32:cdcc91651e55
- Parent:
- 31:7fa2c47d73a2
Initial commit of the change to a more script based approach for easier lab scripts
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jah128 | 31:7fa2c47d73a2 | 1 | /********************************************************** |
jah128 | 31:7fa2c47d73a2 | 2 | * UKESF Headstart Summer School - Robot Programming Lab * |
jah128 | 31:7fa2c47d73a2 | 3 | **********************************************************/ |
jah128 | 0:8a5497a2e366 | 4 | |
jah128 | 31:7fa2c47d73a2 | 5 | // Note: A line beginning with // is a 'comment' and is |
jah128 | 31:7fa2c47d73a2 | 6 | // ignored by the compiler [it is shown in green text in the IDE] |
jah128 | 0:8a5497a2e366 | 7 | |
jah128 | 31:7fa2c47d73a2 | 8 | // Include main.h - this contains the code needed to setup |
jah128 | 31:7fa2c47d73a2 | 9 | // the Psi-Swarm robot and its hardware |
jah128 | 10:1b09d4bb847b | 10 | #include "main.h" |
jah128 | 9:085e090e1ec1 | 11 | |
jah128 | 31:7fa2c47d73a2 | 12 | // You can change the author name to saomething else if you want - just make sure it is no more than 16 characters long |
jah128 | 10:1b09d4bb847b | 13 | char * author_name = "YRL"; |
jah128 | 0:8a5497a2e366 | 14 | |
jah128 | 1:f6356cf1cefc | 15 | /// The main routine: it is recommended to leave this function alone and add user code to the above functions |
jah128 | 6:ff3c66f7372b | 16 | int main() |
jah128 | 6:ff3c66f7372b | 17 | { |
YRL50 | 32:cdcc91651e55 | 18 | // Call external variable setting code |
YRL50 | 32:cdcc91651e55 | 19 | #include "setMotorSpeeds.txt" |
YRL50 | 32:cdcc91651e55 | 20 | |
jah128 | 31:7fa2c47d73a2 | 21 | // init() in psiswarm.cpp sets up the robot - we need to run this line of code before anything else or the robot won't work. |
jah128 | 0:8a5497a2e366 | 22 | init(); |
jah128 | 31:7fa2c47d73a2 | 23 | |
YRL50 | 32:cdcc91651e55 | 24 | // Call the scripted actions |
YRL50 | 32:cdcc91651e55 | 25 | #include "script.txt" |
jah128 | 31:7fa2c47d73a2 | 26 | |
jah128 | 31:7fa2c47d73a2 | 27 | // When we have finished our code, we want to leave the MBED in an endless loop. |
jah128 | 31:7fa2c47d73a2 | 28 | while(1){} |
jah128 | 31:7fa2c47d73a2 | 29 | } |
jah128 | 31:7fa2c47d73a2 | 30 | |
jah128 | 31:7fa2c47d73a2 | 31 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
jah128 | 31:7fa2c47d73a2 | 32 | |
jah128 | 31:7fa2c47d73a2 | 33 | // You can ignore the code beyond this point: we need these variables and functions to make the code |
jah128 | 31:7fa2c47d73a2 | 34 | // compile without errors, but we aren't using the functions for this lab session. |
jah128 | 31:7fa2c47d73a2 | 35 | char * program_name = "Headstart"; |
jah128 | 31:7fa2c47d73a2 | 36 | char * version_name = "0.5"; |
jah128 | 31:7fa2c47d73a2 | 37 | void handle_switch_event(char switch_state){} |
YRL50 | 32:cdcc91651e55 | 38 | void handle_user_serial_message(char * message, char length, char interface){} |