|
anticipation
|
#include <iostream>#include <cstdlib>#include <thread>#include "GPIO.h"#include "GamePlayer.h"#include <unistd.h>
Functions | |
| int | main (int argc, char *argv[]) |
This code is developed as part of the MSOE SWE4211 Real Time Systems course, but can be freely used by others.
SWE4211 Real Time Systems is a required course for students studying the discipline of software engineering.
This Software is provided under the License on an "AS IS" basis and without warranties of any kind concerning the Software, including without limitation merchantability, fitness for a particular purpose, absence of defects or errors, accuracy, and non-infringement of intellectual property rights other than copyright. This disclaimer of warranty is an essential part of the License and a condition for the grant of any rights to this Software.
This file contains the main logic that allows a user to play the game of anticipation.
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
This is the main program. It will instantiate two game players, start their threads, wait for the threads to finish, and then determine who has the lower time.
Declare a pair of Game players, initializing with the appropriate GPIO pin / port numbers that you will be using.
Start each of the two threads up using the C++ thread library that was covered in Operating Systems.
Wait for the game threads to end. Do this by waiting for the threads to die off.
Print out the total latency in ms for the two players.
Turn off all lights.
Turn on the green light for the winner.
Wait 15 seconds and exit, with the lights turning off then.
