5

I'm a GPIO newbie experimenting with getting my Raspberry Pi to blink an LED with C using the wiringPi library. The example code at http://wiringpi.com/examples/blink/ (blink.c) compiles perfectly and runs as advertised.

Here's my question: the documentation at http://wiringpi.com/pins/ states that "wiringPi supports its own pin numbering scheme as well as the BCM_GPIO pin numbering scheme", but I can't find any instructions on how to use the BCM_GPIO numbers. I realize that there may be good reasons to prefer the wiringPi numbering scheme over BCM_GPIO, but for the sake of knowing how it's done, how would I change blink.c to use the BCM_GPIO numbering scheme?

lefthander
  • 153
  • 1
  • 3

1 Answers1

5

To set a pin numbering scheme you use one of four Setup functions:

  • int wiringPiSetup (void);
  • int wiringPiSetupGpio (void);
  • int wiringPiSetupPhys (void);
  • int wiringPiSetupSys (void);

To use BCM GPIO numbering you would replace you would use wiringPiSetupGpio(void); and modify the pin numbers in your code appropriately.

janos
  • 561
  • 3
  • 16
Steve Robillard
  • 34,988
  • 18
  • 106
  • 110