We communicate with the sensors through I2C. Because the sensors are identical, we assign them unique addresses every time the system starts. We set them to read continuously. In the loop, we read each sensor and set a “triggedSensors” variable to a unique value for any combination of triggered sensors, where triggered means reading within a given set of values. Much of the sensor functionality is accessed through a header file.
We communicate with the servos through PWM ports. Depending on which sensors are triggered, a switch statement instructs the motors to turn and bloom to different specifications.