classdef DigitalInput < handle
    properties
        mux;
        channel;
        value;
    end
    
    methods
        function obj = DigitalInput(mux, channel)
            obj.channel = channel;
            obj.mux = mux;
        end
        
        function val = read(obj)
            obj.mux.set(obj.channel);
            val = obj.mux.readDigital();
        end
    end
    
    methods(Static)
        function test
            pi = raspi('10.0.0.104', 'pi', 'HenryPump@1903');
            mux = MuxSetup(pi);
            digIn1 = DigitalInput(mux, 1);
            digIn2 = DigitalInput(mux, 2);
            digIn3 = DigitalInput(mux, 3);
            digIn4 = DigitalInput(mux, 4);
            digIn5 = DigitalInput(mux, 5);
            digIn6 = DigitalInput(mux, 6);
            digIn7 = DigitalInput(mux, 7);
            digIn8 = DigitalInput(mux, 8);
            
            digIn1Val = digIn1.read()
            digIn2Val = digIn2.read()
            digIn3Val = digIn3.read()
            digIn4Val = digIn4.read()
            digIn5Val = digIn5.read()
            digIn6Val = digIn6.read()
            digIn7Val = digIn7.read()
            digIn8Val = digIn8.read()
        end
    end
    
    
end