I'm not a code guy, I'm more into analog electronics. Anyway, if you're building the system by yourself, you'd want to write the code yourself, so that you can troubleshoot it properly according to your construction.
LDRs are good enough for protos, you're not running them like real fast, right? The response of comparators towards the change in the LDRs are fast, build it yourself and you'll see.
Start with this: LM358, download the datasheet, and build the circuit for comparators. You'll be asking less if you built it first.
Here's the circuit:
**broken link removed**