I am doing a project which consists in controlling Arduino through a website. I am fairly new to this and the deadline approaches for project delivery. For communicating with the Arduino I am using a COM port. Anyway, my question is, is there anyway to auto select the arduino port in PHP? It feels so bad when I have to run all the code and change all COM’s to the one I want.
It sounds like an interesting architecture.
The more usual way of getting an Arduino to interface with a web site is that the Arduino is directly integrated into the local network with WiFi or Ethernet. The Arduino issues HTTP Post/Get commands to the Webserver and on the web server there is PHP/HTML code which interprets those commands, writing to or reading from a database. To illuminate a LED on the Arduino, as in this instance, a user would use a web page which set a status row in a database to indicate that the LED should be on, and the Arduino would poll regularly to see what the current LED status should be and set it accordingly.
6v6gt:
The more usual way of getting an Arduino to interface with a web site is that the Arduino is directly integrated into the local network with WiFi or Ethernet. The Arduino issues HTTP Post/Get commands to the Webserver and on the web server there is PHP/HTML code which interprets those commands, writing to or reading from a database.
I have built a couple of small Python web-servers to provide a GUI for {a} model train control and {b} control of a small CNC lathe. In both cases the server is connected to the Arduino by the USB cable. The purpose of the web-server is to act as an interface to the Arduino.
I have the impression from the mention of a COM port in the Original Post that this is what the OP has in mind.
I've created a Python HTTP to Serial gateway to handle this kind of thing in the past. With python twisted you can make it nicely asynchronous. The PHP script (or rather the ajax/javascript in my case) talks to the python webserver and issues commands that are relayed to the Arduno. I must put it up on Github some time (it requires some cleanup first).
The Wemos connects to WiFi and acts as a server, hosting a simple web page. Users can connect to this page and set the desired colour and brightness. No PC, no PHP, no Arduino!
The Wemos can be programmed using the Arduino IDE.