Return a list of all pin names available for the board

Hello all,

I am working on a new STM32F401 "Black Pill" from Weact. I imported the STM Board manager and successfully connected and loaded the Led Flash program. But the Led does not flash.

I suspect the problem is incorrect Pin Name. Here is the code I loaded:

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

My first idea is to use the actual Pin Name but I am not sure what the correct name is. I might be PC13 or C13. Is there a way to list all the PinNames as defined by the Board manager? Or where is the Board Manager files stored on my Windows 10 computer? I assume I can find the pin names in the file...if I could find the file.

Thank you,
Mike

Update.... I figured out what was wrong with my setup, I choosed the wrong board in the setup.

I am still curious if there is a way to list all the pin names for the board in the IDE.

Thank you

I don’t have any experience with STM32, but at least with the more common Arduino platforms, pins are identified with integers. Here you can see the definition of LED_BUILTIN for the Uno:

#define LED_BUILTIN 13

So there is no magic to LED_BUILTIN. It’s just a macro set to the number 13 with out any special association to the pins on an Arduino board. You could use that macro in any expression if you liked. So there is no way to say whether a given variable or macro is intended to be a pin number, or a number for some other purpose.

You will usually find these definitions in the core variant files for the board you’re using. So you can open those files up and see what is defined. If you’re using a standard manufactured board, the pin numbers of the broken out pins will usually be printed on the silkscreen of the board, and you can use those numbers in any of the Arduino functions that use pins, so most Arduino users would never bother to dive into the core source code, but it’s always there to study and experiment with.

An easy way to find the location of the boards platform installation location of your board is as follows:

  • Select a board from the platform you want to find from the Tools > Board menu
  • File > Examples > SPI > BarometricPressureSensor (or any other SPI example sketch)
  • Sketch > Show Sketch Folder
  • Move up folder levels until you reach the one that contains boards.txt

From there, you will find the core variant files under the variants folder and the core library under the cores folder.

Brilliant, Thank you for the tip. I was able to find the files.

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per