All analog pins in Nucleo-F103RB
Posted: Thu Mar 04, 2021 7:44 am
Hello.
I am trying to set D0 and D1 pins on the Nucleo-F103RB board as analog input. These two pins are PA3 and PA2 and are the third and second inputs of ADC (in STM32F103RB). I have written this program and connected the output pin of a potentiometer to PA2. I change the voltage on PA2 between 0 and 3.3 volts. The result of the program should be a change in the blinking speed of the built-in LED. The blinking speed of the LED should be constant when the potentiometer position is constant. But the blinking speed is not constant and its speed is random.
I discovered the Nucleo-F103RB analog pins as follows:
A6 -> D11 (PA7)
A7 -> D12 (PA6)
A8 -> D13 (PA5)
A9 -> pin 35 on CN7 (PC2)
A10 -> pin 37 on CN7 (PC3)
A11 -> pin 24 on CN10 (PB1)
A12 -> pin 34 on CN10 (PC4)
A13 -> pin 6 on CN10 (PC5)
But A14 and A15 are not defined.
I am using Arduino IDE. Sorry for my poor English.
Thank you for your guidance.
I am trying to set D0 and D1 pins on the Nucleo-F103RB board as analog input. These two pins are PA3 and PA2 and are the third and second inputs of ADC (in STM32F103RB). I have written this program and connected the output pin of a potentiometer to PA2. I change the voltage on PA2 between 0 and 3.3 volts. The result of the program should be a change in the blinking speed of the built-in LED. The blinking speed of the LED should be constant when the potentiometer position is constant. But the blinking speed is not constant and its speed is random.
Code: Select all
void setup()
{
analogReadResolution(12);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
delay(analogRead(PA2)); // or delay(analogRead(digitalPinToAnalogInput(D1)));
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
I discovered the Nucleo-F103RB analog pins as follows:
A6 -> D11 (PA7)
A7 -> D12 (PA6)
A8 -> D13 (PA5)
A9 -> pin 35 on CN7 (PC2)
A10 -> pin 37 on CN7 (PC3)
A11 -> pin 24 on CN10 (PB1)
A12 -> pin 34 on CN10 (PC4)
A13 -> pin 6 on CN10 (PC5)
But A14 and A15 are not defined.
I am using Arduino IDE. Sorry for my poor English.
Thank you for your guidance.