• [^] # Re: Qu'est-ce qui te bloque?

    Posté par . En réponse au message Shell script-->langage C. Évalué à 1.

    bonjour
    voila ce que j'ai essayé:
    int main()
    {
    int p; char tab[max_N];
    int gpio = 26;
    p=open("/sys/class/gpio/export", O_WRONLY);
    sprintf(tab, "%d", gpio);
    write(p, tab, strlen(tab));
    close(p);
    sprintf(tab, "/sys/class/gpio/gpio%d/direction", gpio);
    p = open(tab, O_WRONLY);
    write(p, "out", 1);
    write(p, "in", 3);
    close(p);
    if [ -d "$GPIOPIN" ] then
    fprintf ("Blinking LED connected to Pin $PIN ...")
    else
    // echo $PIN > /sys/class/gpio/export

    fprintf("Blinking LED connected to Pin $PIN ...")
    //sleep 1
    else
    while (true) do
    {
    sprintf(tab, "/sys/class/gpio/gpio%d/value", gpio);
    p = open(tab, O_WRONLY);
    write(p, "1", 1);

    write(p, "0", 1);
    close(p);
    return 0;
    }