0

First time actually using the hedears on my raspberry pi zero w. These headers were soldered on when I got it.

When I connect my red lead to the 5v pin, it lights up, so the circuit's correct. When I connect it to pin 16, I get nothing. I believe I'm interpreting the pins correctly.

It occurs to me the I think I assumed that the pins put out 5 V.

Here it is lit with 5v.

enter image description here

Here it is attached to pin 16:

enter image description here

Here is my source code:

#include <wiringPi.h>
const int RED_LED = 16;
int main (void)
{
    wiringPiSetup () ;
    pinMode (RED_LED, OUTPUT) ;
    for (;;)
    {
        digitalWrite (RED_LED, HIGH);
        delay(500);
        digitalWrite (RED_LED, LOW);
        delay(500) ;
    }
    return 0 ;
}

1 Answer 1

1

The function wiringPiSetup() tells the wiringPi library to use its own numbering scheme.

wiringPi 16 refers to GPIO 15 which is connected to pin 10.

See https://pinout.xyz/

I strongly suggest you get jumper leads soon. Crocodile leads make it too easy to short adjacent pins.

ALL Pi GPIO are 3V3.

2
  • I tried physical pin 10, but that didn't get me any light either. Should I not be using wiringPiSetup()?
    – Thom
    May 12, 2021 at 20:21
  • You can use any function you want. It is personal preference.
    – joan
    May 12, 2021 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.