Tripline for LED

Hey, I have a problem, i don't know how to code this thing, so that when its broken it turns on an L.E.D. This is the sensor im using: http://www.let-elektronik.dk/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=258&category_id=13&option=com_virtuemart&Itemid=87

It simply has to turn on an led with the "line" is tripped.

if you could provide me with help on how to code it, and how to wiring it to my arduino :)

There is a sample program shown in that link you posted, have you tried that? The sensor is a 3 wire type using a ground, +5vdc, and a signal that is wired to a Arduino input pin. I've played with that sensor and it has a sensing limit of around 40" max as I recall, but otherwise worked great.

Lefty

it didnt work for me :S nothing happend

i dont know if im wiring it correctly, how should i wire it?

i dont know if im wiring it correctly, how should i wire it?

Draw how you have it wired now and then we can comment on it.

Lefty

yellow wire to digital 8, red to volt, green to ground

theres even light in the sensor, but it doesn't get any inputs

theres even light in the sensor, but it doesn't get any inputs

Mine also has a green led near where the cable leaves the back of the sensor. Black goes to ground, red goes to +5vdc. The led on the sensor should turn on and off as you cover the front of the sensor even with nothing wired to the yellow wire. Test that first.

Lefty

there is a yellow wire, a green wire and a red wire. i've hooked the green wire to ground, the red to +vdc, and the yellow as data. and i did what you said, with unplugging the yellow wire, to see if it turns on and off and it still doesn't :(

there is a yellow wire, a green wire and a red wire. i've hooked the green wire to ground, the red to +vdc, and the yellow as data. and i did what you said, with unplugging the yellow wire, to see if it turns on and off and it still doesn't :(

Well you could have a bad sensor I guess. Be sure that you hold the sensor clear of any obstruction or surface to get a valid off condition, that is point it up in the air for off and cover front with your hand for on.

Lefty

i have 2 sensors, and none of the work, its clear from any obstructions and i'm moving my hand in front of it, and removing it, still the LED is just turned on the whole time :S

Perhaps there is a difference in wire colors then what is expected. There is a picture of the connector in that link you posted in the first post showing a picture of the connector and showing their functions, G, for ground, V for voltage and S for signal. Is that the same order that your colors are arranged in? My sensor has the same order of wires but they are G=black, V=red and yellow=signal top to bottom just like the picture.

Lefty

Electronic brick - Diffuse reflection IR Switch sensor (Analog)

Try connecting the signal line to an analog pin, read it and just spit the raw data out over serial.

void setup(){
  Serial.begin(9600); // Start Serial.
  pinMode(A0,INPUT); // Make Analog 0 an input.
}
void loop(){
  int val = analogRead(A0); // Read analog 0.
  Serial.println(val); // Spit the value out over serial.
  delay(50); // Wait abit.
}