LINUX.ORG.RU

История изменений

Исправление ZugDuk, (текущая версия) :

НЕ РАБОТАЕТ !!! Как сделать, чтобы программа работала?

#include <stdio.h>
#include <wiringPi.h>
#define P_BTN_PWR    24
#define P_BTN_RUN    25
#define WAIT_NPRES   100
#define WAIT_PRES    3000
#define MAX_CMD_LINE 128

int main(int argc, char* argv[])
{
int run = 0;
char script[MAX_CMD_LINE];

wiringPiSetup();
pinMode(P_BTN_PWR, INPUT);

while(1)
if(digitalRead(P_BTN_PWR) == LOW)
system("shutdown -h now");

delay(WAIT_NPRES);
    return 0;
}

Исходная версия ZugDuk, :

НЕ РАБОТАЕТ !!! Как сделать, чтобы программа работала?

#include <stdio.h>
#include <wiringPi.h>
#define P_BTN_PWR    24
#define P_BTN_RUN    25
#define WAIT_NPRES   100
#define WAIT_PRES    3000
#define MAX_CMD_LINE 128

int main(int argc, char* argv[])
{
int run = 0;
char script[MAX_CMD_LINE];

wiringPiSetup();^M
pinMode(P_BTN_PWR, INPUT);^M

while(1)
if(digitalRead(P_BTN_PWR) == LOW)
system("shutdown -h now");

delay(WAIT_NPRES);
    return 0;
}