Using Photoeletric Sensor

I'm using a retro-reflexive sensor on arduino, I just plugged it in on a 12v, it works right without use arduino(it has a own led that pin when detect or not). But the input to arduino is going bad, I can't retrieve any info

I'm using a C2RP-F400CP from optex

This is the manual from it:

This is the wires, right pluged and the output at analog pin A0

I used the example of DigitalReadSerial and plugged my output at A0 when it detect something it is aways 001001010010101 or something like that and when dont detect aways 0, I want that when detect find aways 1111111

Reads a digital input on pin 2, prints the result to the serial monitor

This example code is in the public domain.

// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;

// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
// make the pushbutton's pin an input:
pinMode(pushButton, INPUT);

// the loop routine runs over and over again forever:
void loop() {
// read the input pin:
int buttonState = digitalRead(pushButton);
// print out the state of the button:


Try sticking a delay in the loop and reading the sensor once every 200 milliseconds.

That don't worked =/

How do you have it hooked up?
I don't know for sure, but to me it looks like:
Brown to 12v
Blue to ground
Assume Light On and go White to 12v
Leaving Black as the output.

I am guessing Black will jump between 12v and 0v depending on if the thing sees something.
12v is too much to read direct with the Arduino, so what are you doing with that?