I am trying to do a very simple gpio_read from an analog input port but without any success.
I am using the b-l072z-lrwan1 board with a simple analog sensor on A2 pin.
gpio_t pin = GPIO_PIN(PORT_A, 4); gpio_init(pin, GPIO_IN); int reading = gpio_read(pin);
The value I get is either 16 (when the sensor is connected to the pin), or 0 (when the sensor is not connected). No other values.
As weird as it may sound, I cannot find any kind of example for reading sensor values using gpio read…
Thanks for the help.