#pragma once #include class Pump { public: static const uint16_t blinkTime = 1000; enum State { Off, On, Timer, Standby, Error }; Pump(uint8_t pumpPin, uint8_t pressurePin, uint8_t flowPin, uint8_t errorLedPin); void loop(); void activate(uint32_t duration = 0); void stop(); void clearError(); uint16_t getPressure(); uint32_t getRunningTime(); uint16_t getFlow(); State getState() { return this->state; } private: void checkSensors(); State state = State::Off; bool ledState = false; uint8_t pumpPin; uint8_t pressurePin; uint8_t flowPin; uint8_t errorLedPin; uint32_t startTime; uint32_t duration; };