**LDR Description ** That diagram on page 62 of the manual, has one lead of the LDR connected to +5 volts. The other lead of the LDR is connected to a 10 K resistor. The other lead of the 10K resistor is connected to ground. The connection between the 10k and the LDR has a wire that goes to your ADC input if the PICAxe. (ADC1 in the example code). THe example appears to also have LEDs attached to ouputs 0 and 4, to show what the ADC is reading.
yes I have done exactly that, set up a voltage divider with an LDR and 10K resistor. It works fine for me and is quite easy to build on the end of the ribbon cable, which has connections to +5V and ground as well as the inputs.
No, brown, black orange. 10K No, brown, black orange. 10K = 10.000. The first two digits are determined by the first two rings, brown = 1, black = 0. The last ring is the multiplier, in this case 3, because 10^3=1000, and 3 is orange. See http://n1ofz.connares.org/resources/resistor_code.gif
The voltage at the junction between resistor and LDR wil go up and down according to the resistance of the LDR, which will itself vary according to light.
main: ‘ make a label called main readadc 2,b0 ‘ read channel 1 into variable b0 debug b0 ‘ transmit value to computer screen pause 500 ‘ short delay goto main ‘ jump back to the start
In the pic the LDR is connected to a 10k resistor.
The black wire is connected to +5V, red to analouge input and the yellow to ground.
The problem is that the debug constantly reads 225 and i an i have absolutely no idea what i am doing wrong !
That’s the first one I see, be sure you are looking at the right adc channel.
Also, the ADC’s on the 28x1 board are a little funny. Signal is in the middle and with this you could easily have you servo connector in backward. Double check your pin-outs and be sure you have ground on the resistor side and + going directly to the ldr. Also, to check the LDR is not fried, use a measure-thingie (multi-tester) the reading should fluctuate as you wave your hand over the sensor.
about the channel, it is from the manual, i modified the code to see if channel 1 was not working but the code is programmed for the right channel that the LDR is plugged into.
I tryed testing it as you said, i was hopeing that the LDR was fried so that the problem would be solved unfortunately the resistance changed depending on the light!!
i gave up the idea of trying to move a servo, onece i get the debug working i will be able to figure it out.