#ifndef Twist_h #define Twist_h #include "Arduino.h" #include class Twist { const int servoPin = 9; // servo pin Servo servo; // the servo int directionState = 1; //direction state of 1 = closed, direction state of 0 = open int pos = 90; // variable to store the servo position int increment; // increment to move for each interval int updateInterval; // interval between updates unsigned long lastUpdate; // last update of position unsigned long previousMillisAutoOpen = 0; // will store last time LCD was updated unsigned long currentMillisAutoOpen; const unsigned long intervalAutoOpen = 24UL*60UL*60UL*100UL; // Check whether blinds were opened every 24 const unsigned long waitAutoOpen = 2UL*60UL*60UL*100UL; //2 hr wait for auto open const int buttonPin = 8; // pushbutton pin byte buttonPushCounter = 0; // counter for the number of button byte lastPushCount = 0; int buttonState = 0; int lastButtonState = 0; const int ldrPin = 6; // light dependent resistor pin int ldrState = 0; // local variable to hold ldr states public: Twist(int interval); void Attach(int pin); void Detach(); void Update(); void AutoOpen(); }; #endif