#ifndef MuxClient_h #define MuxClient_h #include "Arduino.h" #define digital_write 0 #define analog_write 1 #define digital_read 2 #define analog_read 3 class MuxClient { public: MuxClient(); MuxClient(int adress, int type); // static enum readType {digitalWrite, analogWrite, digitalRead, analogRead}; static void setupMux(int adressPin1, int adressPin2, int adressPin3, int adressPin4, int data, int enable); static void powerMux(bool state); //true = Pin Low = Power ON! bool powerMux(); void setAdress(int adress); int read(); int bufferedRead(int bufferSize, int scale); void listen(); void write(int value); static int dataPin; // static String errorMessage; int clientAdress; // String clientName; int clientType; private: int outputDigital; int outputAnalog; int bufferValue[64]; unsigned int counter; static bool muxReady; static int adressPins[4]; static int enablePin; static bool state; //true = Pin Low = Power ON! }; #endif /* MuxClient fanSenseLeft(16, digitalRead); MuxClient potentiometer(8, analogRead); MuxClient switch(3, digitalRead); Button switch_pro(switch); // requires Button.h setupMux(A0, 8, 4, 7, A7, A6); switchState = switch.read(); if (switch_pro.buttonState == pressed) { // do something when button is pressed } if (switch_pro.buttonState == released) { // do something when button is released } if (switch_pro.buttonState == held && switch_pro.holdTime > 500) { // do something when button has been held for 500ms if (switch_pro.interval(50)) { // do something repeatedly at 50ms interval } } */