#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
  const int buttonPin = 2;     // the number of the pushbutton pin
  int buttonState = 0;         // variable for reading the pushbutton status
//=========================================================
void setup() {
  pwm.begin();
  pwm.setPWMFreq(60);                                      //Default is 1000mS
 // Serial.begin(9600);
 // while (! Serial);
 // Serial.println("Please input your command to control this Lamp:");  //print message on serial monitor
  pinMode(0, INPUT_PULLUP);                                //CNC Servo
  pinMode(1, INPUT_PULLUP);                                //CNC Servo 
  pinMode(buttonPin, INPUT);
}
//=========================================================
void loop() {
  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {
    Serial.println("Open");
    pwm.setPWM(1, 0, 100);                                 //Gate Open
    pwm.setPWM(0, 0, 300);                                 //Gate Open
  } else {
    Serial.println("Close");
    pwm.setPWM(0, 0, 100);                                 //Gate Open
    pwm.setPWM(1, 0, 300);                                 //Gate Open
  }
   delay (500);
}
//=========================================================
