10 years, 4 months ago.

Serial Read

Is it possible to read a voltage that is being applied to a analog read pin from a voltage divider. Im using the LPC 1768, and the putty serial read program

1 Answer

10 years, 4 months ago.

Have you looked at the AnalogIn Handbook Page? On the LPC1768, you can use pins 15-20 as to read a voltage between 0 and 3.3v.

I think as long as the voltage doesn't go above 3.3v, it should be fine from a voltage divider.

Is that what you were after?

Sort of. I have 3.3 volts being applied to a voltage divider consisting of to light dependent resistors. when the resistance changes I have my code to scan for .80 percent of the applied voltage and also to scan for .20 percent of the applied voltage to. What I would like to be able to do is see in real time with a serial read program to my computer,so i can see the amount of applied voltage that is at my analog in pin.

posted by Grant Dean 12 Dec 2013

Simply use printf:

printf("Value = %f \r\n", your_analogin * 3.3);

3.3 if you want it in Volt, if you just want a ratio leave it out. And your_analogin here is your analogin pin you made earlier.

posted by Erik - 12 Dec 2013

Thanks so much Erik. Will try this out.

posted by Grant Dean 12 Dec 2013