Hi my adc is very unstable i only probe read a value from a potentiometer conected to 3.3v and gnd and one lcd to present the value
in the lcd i can read the value between 0.0 to 1.0 and read well for example 0,5.... but it chages to 1,00 and return 0,5... and repeat and repeat, the same thing happen when i conecct the input to groun the value is 0,000 and change to 1,000
the code is
 
#include "mbed.h"
#include "TextLCD.h"
 TextLCD lcd(p5, p6, p7, p8, p9, p10); 
PwmOut out(p21);
AnalogIn vel(p16);
DigitalOut out1(p27);
DigitalOut out2(p28);
int main() {
   out1=1;
   out2=0;
    while(1) {
   
    out=vel.read();
    
    lcd.locate(0,1);
   lcd.printf("%0.3f   ",vel.read());
    wait(0.3);
       
    }
}
i also probe without lcd only with adc and pwm to LED1 and i have the same
please help me thanks
                    
                 
                
             
        
Hi,
I was testing the analog input. A few weeks ago i also tested is, and readout was fine. But now it is unstable. I give it 3.3Vin , and the readout varies between 2V and 5V.
code:
void MeasureBattery() { usCurrentValue =(Sense5.read_u16()&0xFFF); //pc.printf("batterij op: %d \n\r", (usCurrentValue*5/4095)); pc.printf("\n ADC Val : %f Volts = %d (Decimal Reading) \n\r",(usCurrentValue*5.0/4095),usCurrentValue); wait(5); // what do we if under 20% ?? do a warning and shutdown? // code comes heres // main(); }Any thoughts about whats going on?