We can control everything with this project, but I took LED as an example.DemoWorking Flow
A pattern string is hard-coded in server side code.
When PHPoC receives the input pattern string from user, It will compare the input pattern with hard-coded pattern. If they are the same, PHPoC sends the ACCEPTED code to client (Web browser) and sets the authenticated variable to true . Otherwise, PHPoC sends the DENIED code to client and set the authenticated variable to false.
When PHPoC receives a control command from user, it will check the value of the authenticated variable first. If the value is true, It performs the task corresponding with command. If the value is false, It sends the DENIED code to client.Pattern Mapping
Pattern will be mapped to a string. For example, in above image, pattern string is "1,4,8,6,3".Source Code
Source code includes two files:
- task0.php: This file is server side code. It is run in infinite loop to receive and handle data from web browser, control devices.
To buy electronic components, you can order them from utsource.net