das geht ganz einfach so:

Code:
if (ldr1 > (ldr2 + tol))
{
}
else if (ldr1 < (ldr2 - tol))
{
}
else
{
}