URGENT ! Question for connecting a light barrier

A connected brown (12 V) and blue (GND). And black to another cable which goes to digitalport, then a 10 K resistor and after the resistor another gnd.