diff --git a/Template Project/lib/ESPMegaPRO/ESPMegaPRO.cpp b/Template Project/lib/ESPMegaPRO/ESPMegaPRO.cpp index 5f04603..a64a058 100644 --- a/Template Project/lib/ESPMegaPRO/ESPMegaPRO.cpp +++ b/Template Project/lib/ESPMegaPRO/ESPMegaPRO.cpp @@ -5,7 +5,7 @@ uint8_t inputBufferB; PCF8574 inputBankA(INPUT_BANK_A_ADDRESS); PCF8574 inputBankB(INPUT_BANK_B_ADDRESS); -Adafruit_PWMServoDriver pwmBank = Adafruit_PWMServoDriver(0x5F); +Adafruit_PWMServoDriver pwmBank = Adafruit_PWMServoDriver(PWM_BANK_ADDRESS); void ESPMega_begin() { @@ -15,7 +15,13 @@ void ESPMega_begin() inputBankB.begin(); pwmBank.begin(); + // ESPMegaPRO v3 use the PWMBank to drive Half Bridge + // Push Pull Output is required. + pwmBank.setOutputMode(true); + #ifdef USE_INTERRUPT + pinMode(INPUT_BANK_A_INTERRUPT, INPUT_PULLUP); + pinMode(INPUT_BANK_B_INTERRUPT, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(INPUT_BANK_A_INTERRUPT),refreshInputBankA,FALLING); attachInterrupt(digitalPinToInterrupt(INPUT_BANK_B_INTERRUPT),refreshInputBankB,FALLING); #endif diff --git a/Template Project/lib/ESPMegaPRO/ESPMegaPRO.h b/Template Project/lib/ESPMegaPRO/ESPMegaPRO.h index c699d02..23e8288 100644 --- a/Template Project/lib/ESPMegaPRO/ESPMegaPRO.h +++ b/Template Project/lib/ESPMegaPRO/ESPMegaPRO.h @@ -7,13 +7,14 @@ #include #define INPUT_BANK_A_ADDRESS 0x21 -#define INPUT_BANK_B_ADDRESS 0x20 +#define INPUT_BANK_B_ADDRESS 0x22 +#define PWM_BANK_ADDRESS 0x5F #define OUTPUT_BANK_ADDRESS 0x21 #define EEPROM_ADDRESS 0x22 //#define USE_INTERRUPT -//#define INPUT_BANK_A_INTERRUPT 35 -//#define INPUT_BANK_B_INTERRUPT 39 +#define INPUT_BANK_A_INTERRUPT 36 +#define INPUT_BANK_B_INTERRUPT 39 /** * Initiate ESPMega PRO Internal Components diff --git a/Template Project/src/input_test.cpp b/Template Project/src/input_test.cpp index 51e34ae..c2e2915 100644 --- a/Template Project/src/input_test.cpp +++ b/Template Project/src/input_test.cpp @@ -6,12 +6,12 @@ void setup() { } void loop() { - if(ESPMega_digitalRead(7)) { + if(ESPMega_digitalRead(11)) { ESPMega_digitalWrite(8, HIGH); - Serial.println("7HIGH"); + Serial.println("11HIGH"); } else { ESPMega_digitalWrite(8, LOW); - Serial.println("7LOW"); + Serial.println("11LOW"); } ESPMega_loop(); } \ No newline at end of file