TCS34725 and Wemos D1 Error

Hello i would like to sense color of 3d printer filament.

and when i upload code i get error
Exception (0):
epc1=0x4000dce5 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

my code is:

#include <Wire.h>
#include "Adafruit_TCS34725.h"

Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);   //Setup the colour sensor through Adafruit library

int R = 0;
int G = 0;
int B = 0;

int minR, minG, minB =255;

int maxR, maxG, maxB = 0;

int minThreshold = 10;
int calibState=0; 

void setup() {
  Serial.begin(9600);
//  if( CALIBRATON )
//  {
//    calibState = 0;
//  }
//  else
//  {
//    minR = minG = minB = 0;
//    maxR = maxG = maxB =255;
//  }

}

void DoButton()
{
  if(calibState == 0)
  {
    minR = R;
    minG = G;
    minB = B;

    calibState = 1;
  }
  else if(calibState == 1)
  {
    maxR = R;
    maxG = G;
    maxB = B;

    calibState = 2;
  }
}

void loop() {
  uint16_t red, green, blue, clear;
  delay(60);
  tcs.getRawData(&red, &green, &blue, &clear);
  uint16_t sum = clear;
  float r, g, b;

  r = red;
  r /= sum;

  g = green;
  g /= sum;

  b = blue;
  b /= sum;
  
  r *= 256;
  g *= 256;
  b *= 256;

  R = r;
  G = g;
  B = b;

  int R2 = map(R ,minR, maxR, 0, 255);
  int G2 = map(G ,minG, maxG, 0, 255);
  int B2 = map(B ,minB, maxB, 0, 255);

  R = constrain(R2, 0 ,255);
  G = constrain(G2, 0 ,255);
  B = constrain(B2, 0 ,255);

  int stateColor = -1;

  if(R > B + minThreshold && R > G + minThreshold)
    stateColor = 0;
  else if(G > R + minThreshold && G > B + minThreshold)
    stateColor = 1;
  else if(B > R + minThreshold && B > G + minThreshold)
    stateColor = 2;

  int color = convertRGB24toRGB565(R,G,B);

 Serial.print("RGB [");
 Serial.print(R);
 Serial.print(",");
 Serial.print(G);
 Serial.print(",");
 Serial.print(B);
 Serial.print("]");

 Serial.print("  MIN [");
 Serial.print(minR);
 Serial.print(",");
 Serial.print(minG);
 Serial.print(",");
 Serial.print(minB);
 Serial.print("]");

 Serial.print("  MAX [");
 Serial.print(maxR);
 Serial.print(",");
 Serial.print(maxG);
 Serial.print(",");
 Serial.print(maxB);
 Serial.print("]");

 Serial.print("   Color:");
 Serial.println(color); 
 delay(1000);
}

uint16_t  convertRGB24toRGB565(uint8_t r, uint8_t g, uint8_t b)
{
  return ((r/8) << 11)|((g/4)<<5)|(b/8);
}

please help

you probably get more stuff describing the issue.. share the whole console output

You have commented out the "calibration" portion of setup() which does this:

 minR = minG = minB = 0;
maxR = maxG = maxB =255;

and instead, declared your variables like this

int minR, minG, minB =255;
int maxR, maxG, maxB = 0;

which only sets minB to 255. The other two variables are still 0.
The second line does actually set all 3 variables to 0 since those are global variables and the C/C++ standard guarantees they are initialized to 0.

I am guessing you are getting some divide by 0 error or something since your min/max variables do not seem correct.