 #include "Wire.h"
 #include "Adafruit_MCP9808.h"
 
-
-
-class PortBase {
-  protected:
-    int8_t port;
-  public:
-  void setup(int8_t _port, int8_t mode) {
-    port = _port;
-    pinMode(_port, mode);
-  }
-};
-
-class AnalogRead : public PortBase {
+template <int8_t port>
+class AnalogRead {
   private:
     int16_t state;
   public:
-    void setup(int8_t port) {
-      PortBase::setup(port, INPUT);
-      digitalWrite(port, HIGH); //pull on
+    void setup() {
+      pinMode(port, INPUT);
+      digitalWrite(port, HIGH); //pull up on
       state = 0;
     }
     int16_t read() {

    }

    int setup() {
      voltage_car.setup(A1);
      voltage_220.setup(A2);
      voltage_vbat.setup(A3);

      relay_inverter_net.setup(1);
      relay_car_220_loader.setup(2);
      relay_vbat.setup(3);
      relay_car.setup(4);

      tempsensor.begin();
      //Serial.println("jo-3");

    const int8_t DONE=0;
    Timer t;

    AnalogRead<A1> voltage_car;
    AnalogRead<A2> voltage_220;
    AnalogRead<A3> voltage_vbat;

    DigitalWrite<1> relay_car_220_loader;
    DigitalWrite<2> relay_inverter_net;
    DigitalWrite<3> relay_vbat;
    DigitalWrite<4> relay_car;

    int16_t times;

