Croduino LDR reading reduced when using pull-up resistor

Customer:

I understand that in serial communication with the LDR, I get the full value range of 0-1024 only when connected without a resistor. As soon as I connect a resistor, I get reduced values. Is this correct, or do I need to use a specific resistor value?

Also, can I still use the output analog value of 0-255 even though the input range is reduced?

Original message (Croatian)

Pozdrav. Nije do pločice nego je pisanja komandi , za relej ne moze se bas pisat high ili low sa plocice nego je malo drugacije, nasao sam na netu.

Interesuje me druga stvar a to je :

Kako sam razumio ja u serijkoj komunikaciji sa LDR-a dobijam punu vrijednost od 0-1024 samo kad ga spojim bez otpornika , cim spojim neki otpornik dobijam umanjene vrijednosti, jesam li u pravu ili trebam odredjen otpornik ubaciti?

I dali opet mogu koristiti vrijednost izlaznog analog 0-255 iako je na ulaznom umanjen raspon ?

Hvala

[name removed]

“Support: e-radionica.com” je napisao(la):

Originally submitted via the contact form on soldered.com on 19 May 2016. Migrated to the forum for community visibility.

Soldered Support:

A pull-up or pull-down resistor is added to prevent pin floating. See: https://e-radionica.com/hr/blog/2015/08/19/pull-up-pull-down-otpornik/

You can use the map() function: https://www.arduino.cc/en/Reference/Map

For example:

izlaz255 = map( analogRead(A0), 0, 1023, 0, 255);

This will proportionally distribute the 0-1023 (10-bit) range into the 0-255 (8-bit) range.

Original message (Croatian)

otpornik se stavlja zbog floatanja pinova: https://e-radionica.com/hr/blog/2015/08/19/pull-up-pull-down-otpornik/
Možete koristiti funkciju map: https://www.arduino.cc/en/Reference/Map
npr.
izlaz255 = map( analogRead(A0), 0, 1023, 0, 255);
Što će proporcionalno raspodjeliti 0-1023(10bitni) u 0-255(8bitni) raspon.