void loop(){ det = check(); // You'll need to reconstruct this if your not using the Pololu Dual VNH5019
Regardless of what coding style you prefer, NOTHING EVER FOLLOWS THE {.
void loop()
{
det = check(); // You'll need to reconstruct this if your not using the Pololu Dual VNH5019
The rest of loop() needs fixing the same way. Use Tools + Auto Format, too.
If you resturucture the check() function so that it is readable, perhaps I'll try reading it again.