Skip to content

Invalid Pin 2 #1

Description

@bangonkali

Why am i getting

linaro@cubieboard2:~/Documents/Projects/wiringPi$ sudo ./wiringTest
invalid pin,please check it over.

My code is the following (changed pin 1 to pin 2)

/**
 * softPwm test
 * author:gootoomoon
 * gcc -o test digital.c -lwiringPi -lpthread
 */
#include <stdio.h>
#include <errno.h>
#include <string.h>

#include <wiringPi.h>
#define OUTPUT  1
#define HIGH    1
#define LOW     0

int pin = 2;

int main()
{
        if(wiringPiSetupPhys() == -1)
        {
                fprintf(stdout, "wiring lib init error:%s", strerror(errno));
                return 1;
        }
        pinMode(pin,OUTPUT);

        for(;;){
                digitalWrite(pin,HIGH);
                delay(1000);
                digitalWrite(pin,LOW);
                delay(1000);
        }
}

Also, If I use pin 1 based on the diagram, my LED doesn't blink.

http://cubiebook.org/images/1/16/Gpio_defination_large.jpg

What could be the problem?

I was able to compile successfully. Here are some outputs:

linaro@cubieboard2:~/Documents/Projects/wiringPi$ gpio -v
gpio version: 2.00
Copyright (c) 2012-2013 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

This Raspberry Pi is a revision 2 board.

However, I am using Cubieboard 2 with Lubuntu.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions