Arduino Due sharing ground

Hello,
I am using Arduino DUE to read photoresistor value and then change brightness of LED using PWM.

I used this tutorial
http://playground.arduino.cc/Learning/PhotoResistor

but when I connect everything as on this picture, it doesnt work


source of picture : https://www.instructables.com/id/How-to-use-a-photoresistor-or-photocell-Arduino-Tu/

but when I use different ground on Arduino for LDR and different ground for LED it works.

Can someone explain me why?

Sorry for stupid question I am new in electronics stuffs.

Thank you very much.

Is your breadboard like this with the top and bottom rows split in the middle. Note the jumpers to tie the 2 halves together.

You know the image shows an UNO, but more importantly, most Due's pins can only provide 3mA. With 220Ω, the current will be (3.3-2)/220 = 5.5mA. R1 needs to be 620Ω or higher.

There are many types of PhotoCells with different ranges for light-dark current, so you may need to change R2 for a higher value like 100K (for example), especially if the ADC reading you get at A0 consistently remains low (light or dark).

Don't for get if you want to take full advantage of the ADC (12-bit), you can use analogReadResolution(12) in Setup so that your ADC values will range from 0-4095.

Don't use 5V on a DUE input!

Seriously, F**ing doesn't have a symbol for a DUE? Is there some way we can warn newbies against using this seductive piece of crap?

The word Instructables in any web address means "caution this is likely to be crap"

There is only one ground on any Arduino electrically speaking, so of you have to use separate ground pins to make anything work then you do not have a continuous ground on the outside circuit.

groundfungus:
Is your breadboard like this with the top and bottom rows split in the middle. Note the jumpers to tie the 2 halves together.

So problem was as groundfungus sugest in breadboard, thank you very much!