Raspberry Pi C++ PHP Gpio

234 Views Asked by At

I'm quite new at programming and I need some help with an understanding of the following problem. I have PHP page which controls some C++ functions and These functions control GPIO of RPi. when I run C++ function everything runs without any problem then I try to run a same C++ function with PHP script it doesn't work.

Thank you a lot for your help and advice Have a nice Holidays

C++

> #include <iostream>
> #include <wiringPi.h>
> 
> int main(int argc,char* argv[]) {
> 
>  std::cout<< argc+5; // this line returns the value to PHP script 
>     wiringPiSetupGpio();    pinMode (17, OUTPUT) ;
> 
>   for (int i=0; i < 10; i++)   {
>     digitalWrite (17, HIGH) ; delay (500) ;
>     digitalWrite (17,  LOW) ; delay (500) ;   } 
>     return 0;

PHP

   <?php


       $foo = True; 
           if(isset($_GET['on'])){
              exec('./blink a b c d',$result);
              echo implode($result);               
           }

 ?>
0

There are 0 best solutions below