// https://wokwi.com/projects/458196949125372929
// https://forum.arduino.cc/t/changing-led-state-with-ir-sensors/1434325
// exit/entry tSensor and BLOCK objects
# include "block.h"
unsigned long now;
const byte button = 7;
const byte button2 = 6;
const byte lamp = 8;
BLOCK blocks[3] = {
{button, button2, lamp},
{A0, A1, A2},
{A3, A4, A5}
};
const byte nBlocks = sizeof blocks / sizeof *blocks;
void setup() {
Serial.begin(115200);
Serial.println("hi Mom!\n");
for (byte ii = 0; ii < nBlocks; ii++)
blocks[ii].begin();
}
void loop() {
now = millis();
for (byte ii = 0; ii < nBlocks; ii++)
blocks[ii].service(now);
}
BLOCK 1000
BLOCK 1001
BLOCK 1002