I would need some help for a smart home project.
I want to build the system using PHP and MySql to administrate the digital and analogue pins for an Arduino Mega.
The ideea is that all pins should be initialised on arduino with the initial state Input.
There should be a loop for gathering the pinmode and pin state from a php page(I don't know how to make that loop) and another loop to update the informations from the sensors to Mysql.
Arduino should work in this way.
Initialising all the pins in input mode.
Gather informations from a php page for the pins, like D0= Input, D1= Output(Low), D2= Output(High) so in this way we will control the arduino pins remote.
Post the informations from all the sensor's in a mysql database for logging and to make scenarios.
Now we will have a page where we can setup different scenarios based on [if D0=1 then D2=High] so all the setup will be made remotely without touching the arduino code.
Thanks for your help!