chore: Add course material

This commit is contained in:
2026-10-05 11:27:21 +02:00
parent 971813c351
commit e8241fd1ff
660 changed files with 26658 additions and 1 deletions
+43
View File
@@ -0,0 +1,43 @@
// =================================================================
// main.cpp (for pelican crossing program)
// =================================================================
#include "ConsolePoleVisitor.h"
#include "Keyboard.h"
#include "Pelican.h"
#include "Pole.h"
#include "PowerVisitor.h"
#include "TimerSet.h"
#include <cctype> // provides toupper()
int main() {
Keyboard kbd;
Pelican thePelican;
Pole pole1(20, 0, thePelican);
thePelican.attach(pole1);
ConsolePoleVisitor cp1(pole1);
pole1.attach(cp1);
Pole pole2(40, 0, thePelican);
thePelican.attach(pole2);
ConsolePoleVisitor cp2(pole2);
pole2.attach(cp2);
char c = 0;
while (std::toupper(c) != 'Q') { // loop until 'Q' is pressed
c = kbd.getChar(); // get the character
if (c == ' ') {
// it's a space, so press the WAIT button
thePelican.press();
} else if (c == 'p') {
PowerVisitor pv;
pv.calculatePower(pole1);
}
}
return 0;
}