Charles Tritt
/
21_SerialPass_v5
New example. Initial version.
main.cpp
- Committer:
- CSTritt
- Date:
- 2021-10-13
- Revision:
- 115:6ba84689e2c9
- Parent:
- 114:1cfad1babb55
- Child:
- 116:8990686eedf5
File content as of revision 115:6ba84689e2c9:
/* Project: 21_TimeSense_v5 File: main.cpp A simple time sense game. Uses VT-100 escape sequences to prevent scrolling. See http://www.csie.ntu.edu.tw/~r92094/c++/VT100.html and/or https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797. Written by: Dr. C. S. Tritt; Last revised 10/13/21 (v. 1.1) */ #include "mbed.h" #include "myFuncs.h" // Construct a USER_BUTTON digital input. DigitalIn myButton(USER_BUTTON); // Construct a timer object. Timer myTimer; // Construct a transmit only serial connection over our USB. Serial pc(USBTX, NC, 9600); int main() { const int TARGET = 5000; // Target time in mS. const int TRIALS = 3; // Number of trials (cycles). int rSum = 0; // Running sum for average in mS. clrTerm(&pc); // Clear the terminal. pc.printf("Hold button down for %f seconds.\n", static_cast<float>(TARGET)/1000.f); while(true) { // Main forever loop. ThisThread::sleep_for(300000); // Sleep for 5 minutes, repeatedly. } }