当前位置:网站首页>The problem of wirengpi program running permission

The problem of wirengpi program running permission

2022-06-25 09:35:00 silno

Recently, with c wiringPi Learning control led, The routine is compiled in linux The command interface can run normally .

Later, I tried to apache Environmental Science , adopt web control led, Never light up ,

It turned out In this function wiringPiSetup(); It's stuck .

Repeat the test , It is found that it is compiled led Insufficient permissions for the program ,

chmod 4755 led 

Grant permission and then pass web Call to control led 了 .

because apache Is set up in linux In the system , many linux The operation of , Permission is required to execute .

therefore , If the program debugged separately can execute normally , If you change the environment, you will make mistakes , It is necessary to consider the issue of the execution authority of the program

 

Add :

There is a blog saying ,https://blog.csdn.net/qq_31669419/article/details/53339770

Run in raspberry pie opencv And GPIO Combined procedures , If you use wiringPiSetup() Set function initialization wiringPi System , When running the program, you must obtain root jurisdiction , But at this point, if you call a function imshow An error occurred when

Actually , stay wiringPi It is also provided wiringPiSetupSys(void) Initialization function , It can be non root The user calls , Provided GPIO Pins must be used in advance gpio Command export . The pin number in this mode is native Broadcom GPIO Pin number (BCM).

wiringPiSetupSys();
pinMode(17,OUTPUT);//BCM The first 17 The foot is wringPI The first 0 foot

Before running the program , First, input the command in the terminal

gpio export 17 out

 

------------------------------------

It's a little bit of a hassle , Give me permission

 

原网站

版权声明
本文为[silno]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202200551256686.html