// Header file includes
// #include <MD_Parola.h>
// #include <MD_MAX72xx.h>
// #include <DHT.h>
// #include <SPI.h>
#include <Wire.h>
//#include "Font7Seg.h"

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
// #define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
// #define MAX_DEVICES 4 // Define the number of displays connected
// #define CLK_PIN    13 // CLK or SCK
// #define DATA_PIN   11 // DATA or MOSI
// #define CS_PIN     10 // CS or SS
// #define SPEED_TIME 75 // Speed of the transition
// #define PAUSE_TIME  0
// #define MAX_MESG   20

int ledpin = 27;
// MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

int enable = 0;
void IRAM_ATTR ISR() {
  //  enable = 1;
  pinMode(23, INPUT_PULLUP);
  enable = digitalRead(23);
}

void setup() {  
  
  Wire.begin();
  Serial.begin(115200);

  // P.begin(2);
  // P.setInvert(false);

  // P.setZone(0,  MAX_DEVICES - 4, MAX_DEVICES - 1);
  // P.setZone(1, MAX_DEVICES - 4, MAX_DEVICES - 1);

  // P.displayZoneText(1, szTime, PA_CENTER, SPEED_TIME, PAUSE_TIME, PA_PRINT, PA_NO_EFFECT);
  // P.displayZoneText(0, szMesg, PA_CENTER, SPEED_TIME, 0, PA_PRINT , PA_NO_EFFECT);

  // P.addChar('$', degC);
  // P.addChar('&', degF);

  // dht.begin();
  // put your setup code here, to run once:
  pinMode(ledpin, OUTPUT);
  digitalWrite(ledpin, LOW);

  pinMode(23, INPUT_PULLUP);
  attachInterrupt(23, ISR, FALLING);

  
}

int pickCount = 0;
void loop() {
   // put your main code here, to run repeatedly:
   Serial.print(enable);
  if (enable ) {
     pickCount ++;
     Serial.println(pickCount);
    digitalWrite(ledpin, HIGH);
    delay(500);
    digitalWrite(ledpin,LOW);
    delay(500);
  }     
}