Code: bool isCounting = false; int startCount = 0; int finalCount= 0; while(true){ if(line is white && !isCounting){ startCount = sensorValue[encoder]; isCounting = true; } if(isCounting && line is black){ finalCount = sensorValur[encoder] - startCount; isCounting = false; } }
|