4 years, 8 months ago.

Why A1 impact the A0 ?

Dear all,

I am use the Nculeo-L433 and L432, get the same problem as below:

The A1 can impact the A0 value, (the A1 never defined in code) 1) When A1 connect to GND: The A0 return 0.5 ~ 1.0 (800h - FFFh) for 0v ~ 3.3v

2) When A1 connect to 3.3V: The A0 return 0.0 ~ 0.5 (0h - 7FFh) for 0v ~ 3.3v

I am use the Mbed Studio with mbed-os 5.13, My simple test code in below:

  1. include "mbed.h"

Serial pc(STDIO_UART_TX, STDIO_UART_RX, 115200); DigitalOut led1(LED1);

main() runs in its own thread in the OS int main() { AnalogIn ain0(A0);

while (true) { printf("A0:%.3f!!\r\n", ain0.read()); led1 = !led1; wait(0.5); } }

1 Answer

4 years, 7 months ago.

Hi MCU Expresso,

As you set A0 pin as AnalogIn object, the value doesn't mean anything if you don't connect it to any source, because it's floating, the value could vary from board and environment.

Thanks, Desmond