gootoomoon / WiringCB-python

wiring-like lib for cubieboard ,port from WiringPi2-Python
33 stars 14 forks source link

failed.wiring at pin 50 #2

Open bangonkali opened 11 years ago

bangonkali commented 11 years ago

After around 2 minutes of good operation, I get this error.

open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.wiring at pin 50.
wiringPiSetup: Unable to open /dev/mem: Too many open files

Here's my source code:

/**
 * 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

#define MIN_PIN 50

int pin = MIN_PIN;

int main()
{
        if(wiringPiSetupPhys() == -1)
        {
                fprintf(stdout, "wiring lib init error:%s", strerror(errno));
                return 1;
        }
        for(;;){
                printf("wiring at pin %d.\n", pin);
                pinMode(pin,OUTPUT);
                digitalWrite(pin,HIGH);
                delay(500);
                digitalWrite(pin,LOW);
                delay(500);
        }
}

And here's the result until the error:

...
wiring at pin 50.
wiring at pin 50.
wiring at pin 50.
wiring at pin 50.
wiring at pin 50.
wiring at pin 50.
wiring at pin 50.
open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.open /dev/mem failed.wiring at pin 50.
wiringPiSetup: Unable to open /dev/mem: Too many open files

What could be the cause? This will somehow become a reliability issue.