read pulses from TSL250R

Hi!
First of all,i am pretty new at this.
I am about the build a laser range finder with the Arduino Uno rev 3 using a laser pointer and a TSL250R Light to voltage sensor as detector.
I wonder if someone could help me with the code for counting the pulses when the laserbeam hits the detector.

Robban

Where did you get a pulses?
http://octopart.com/partsearch#search/requestData&q=tsl250
AFAIS there is a voltage output, just connect to analog input and measure it. Examples in arduino IDE, in Analog section .

I wonder if someone could help me with the code for counting the pulses when the laserbeam hits the detector.

wrote some proto-code for a TSL235R some time ago, assuming this is similar to the 250 it could get you started

/*
 *    FILE: TSL235R.pde
 *  AUTHOR: Rob Tillaart
 *    DATE: 2011 05 16
 *
 * PURPOSE: prototype TSL235R monitoring  
 *
 * Digital Pin layout ARDUINO
 * =============================
 *  2     IRQ 0    - to TSL235R
 *
 * PIN 1 - GND
 * PIN 2 - VDD - 5V
 * PIN 3 - SIGNAL
 *
 */

volatile unsigned long cnt = 0;
unsigned long oldcnt = 0;
unsigned long t = 0;
unsigned long last;
unsigned long msec = 0;
unsigned int cf = 1466;  // cf = 10^0.166 * 1000 (figure 1 datasheet)

void irq1()
{
  cnt++;
}

///////////////////////////////////////////////////////////////////
//
// SETUP
//
void setup() 
{
  Serial.begin(115200);
  Serial.println("START");
  pinMode(2, INPUT);
  digitalWrite(2, HIGH);
  attachInterrupt(0, irq1, RISING);
}

///////////////////////////////////////////////////////////////////
//
// MAIN LOOP
//
void loop() 
{
  msec = millis() - last;
  if (msec >= 1000)
  {
    last += msec;
    t = cnt;
    unsigned long hz = (t - oldcnt) * 1000 / msec;
    oldcnt = t;
    unsigned long mw = (hz * cf/1000 + 50)/100; // +50 == rounding last digit
    
    // smoothing possible...
    Serial.print("FREQ: "); 
    Serial.print(hz);
    Serial.print("\t "); 
    Serial.print(mw);  
    Serial.println(" mW/m2");
  }
}

// END OF FILE

i noticed that the sensoor is using analog voltage and this i have managed to print out. however, to be able to read the distance i need pulses instead, so i need something like

if voltage > threshold then pulse=1
if voltage < threshold then pulse=0

then start counting the pulses...

hope you understand what i mean, so if anyone has an idea of such code / program or more simple program please let me know.

robban