chore: Add course material
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
#include "Keyboard.h"
|
||||
#include "Pelican.h"
|
||||
#include "Pole.h"
|
||||
#include "TimerSet.h"
|
||||
|
||||
#include <cctype> // provides toupper()
|
||||
|
||||
int main() {
|
||||
Keyboard kbd;
|
||||
|
||||
Pelican thePelican;
|
||||
Pole pole1(20, 0, thePelican);
|
||||
Pole pole2(40, 0, thePelican);
|
||||
|
||||
char c = 0;
|
||||
|
||||
while (std::toupper(c) != 'Q') { // loop until 'Q' is pressed
|
||||
|
||||
// Exercise 5.1 no longer needed to poll TimerSet from
|
||||
// while (!kbd.isCharAvail())
|
||||
//{
|
||||
// TimerSet::Instance().pollAllTimers(); // no key press to process, poll the timers
|
||||
//}
|
||||
|
||||
c = kbd.getChar(); // get the character
|
||||
if (c == ' ') {
|
||||
// it's a space, so press the WAIT button
|
||||
thePelican.press();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user