Issues with analogRead() for PB0 on Nucleo G431KB
Posted: Mon Oct 16, 2023 7:47 pm
I am trying to use pin PB0 in analogRead mode on a Nucleo32 G431KB. This is the code that I am using:
When I run this code and change the voltage applied to the pin, there is no response on the serial monitor. Currently, the serial monitor outputs a value, but this value dones't change in accordance with the voltage applied.
I have tested analog read on this pin with HAL using STM32CubeIDE and it works without issues. How do I resolve this issue and make this pin work using stm32duino?
Code: Select all
#include <Arduino.h>
void setup() {
Serial.begin(9600);
pinMode(PB0, INPUT_ANALOG);
}
void loop() {
int analogValue = analogRead(PB0);
Serial.println("Analog Value (PB0): " + String(analogValue));
delay(1000);
}
I have tested analog read on this pin with HAL using STM32CubeIDE and it works without issues. How do I resolve this issue and make this pin work using stm32duino?