Improvements for measurements of the response time of a LDR

Hi everyone
First about the background of my project. I want to transmit data (for example pictures, see Base64) with a laser pointer/a laser diode (using a LED at the moment). As a receiver I want to use an LDR (I know they are slow, but I couldn’t get something better yet). I heard photodiodes would work great in combination with a transimpedance amplifier. But I’m also open for other ideas. I want to use the ASCII code so I need 7 bits for each characters. Over a voltage divider with the LDR the arduino receives the data. Now I need to know how many bits per sec a LDR voltage divider can distinguish (high = 1, low = 0). To figure this out I wrote a short program.
Short summary how the program works:
Arduino1 tells Arduino2 via a voltage divider (Can you use rx/tx here? How?) that he will turn on the LED for x microseconds. Then Arduino2 starts a timer. If he gets a high from the voltage divider with the LDR he stops the time. Then he waits for that the Pin becomes low and stops the time again. Finally he sends the measured times to the serial monitor. Now you can calculate the response time of the LDR.

I attached a drawing of the circuit for better comprehension.

I’d be really happy about some improvements for my code, how to make it faster respectively to make the measurements more accurate.

My code:


void setup() {
DDRB = DDRB | B110000;

void loop() {
  //Start the test with an 1 on the serial monitor
    //Used for debug
    //Turn on the LED and tell Arduino2 to start the timer
    PORTB = B110000;
     //Turn off the LED 
     PORTB = 0;
     //Wait again for the next try..


long zeit = 0;
long zeit2 = 0;
long zeit3 = 0;
int statu = 0;
int eingang = 0;

void setup() {
  pinMode(10, INPUT);
  void loop(){
    //Wait for Arduino1
    eingang = PINB;
    eingang &= 16;
    if (eingang == 16) {
      //Start the timer
      zeit = micros();
      //Wait for the LDR
      while (statu != 48) {
        statu = PINB;
        //Save the measurements
        zeit2 = micros();
        zeit2 -= zeit;
        //Wait for Low
        while(statu == 48){
          statu = PINB;
        zeit3 = micros();
        zeit -= zeit;
        //Reset the variables
        zeit = 0;
        zeit2 = 0;
        zeit3 = 0;
        statu = 0;
        //Wait for the next try

Best wishes


Why 2 Arduinos?

For measuring response times I'd use only one, remember the time and light the LED, then wait for the LDR to respond, and again take the time. The same for turning the LED off.

What about just using an infra red system.

Another thing you might consider using is an Android phone and Bluetooth - see this RemoteXY Thread.