#include <Arduino_FreeRTOS.h>
TaskHandle_t task_handle_1;
void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(2),my_isr,FALLING);
  xTaskCreate(task1, "print task", 128,  NULL, 2,  &task_handle_1 );
}
void loop(){
  //Empty loop
}
void task1(void *pvParameters)  
{
  while(1){
    if (ulTaskNotifyTake(
      pdTRUE,//RTOS task's notification value is reset to 0 before ulTaskNotifyTake() exits.
      portMAX_DELAY))//blocking time) 
      {
      Serial.println("Notification received");
      EIMSK = 1;
    }
  }
}
void my_isr()  
{
  EIMSK = 0;
  vTaskNotifyGiveFromISR(task_handle_1,NULL);
}