I want to control a Raspberry pi to control an arduino which is controlled by a webpage hosted by apache. I do not know how I would attempt this and if it is even possible. Can anyone please guide me in the right direction to do this. I want to press a button and it tells the pi to send an I2C signal to the Arduino to start the motor while the button is pressed.
2 Answers
You need cgi, cgi are scripts or programs run by server. There are plenty of example
You can have a cgi script on server called by web page via forms to start/stop your motor.
You can develop cgi in python, bash, c ...
-
So I could use CGI to turn a motor on when a button is pressed by it sending an I2C signal to the Arduino and turn it off when it isn’t pressed. All in python and Apache? Oct 19, 2017 at 14:52
-
Yes. I make something close to what you want to do (I'm using webpage on mobile phone to open/close portal and garage door) see You can too use an Arduino Yun if your raspberry pi is only used as web server , the Arduino Yun can do the job, but with raspberry pi it is possible too.– flcOct 20, 2017 at 10:21
Use these:
Control rapsberry using PHP.
Use python to execute scripts over i2c
conenct i2c to arduino.
make all arduinos on i2c bus as slave mode to receive a fixed range of bytes.
use these byte data to interpret and pefrom action in arduino using C
pigpiod
?