I'm just an amateur who has taken on the project of building an arduino powered robot to be controlled via web. I have about 3 days(!) experience with php and in that time managed to get a serial port control class written by Remy Sanchez and have set up some basic communication between the Arduino and a php script. So far doing pretty well: http://www.youtube.com/watch?v=I-p_jI98zZU"]http://www.youtube.com/watch?v=I-p_jI98zZU I'm able to send data to the serial port (though it's not working consistently...if I send a "C" to the serial port in php it doesn't get picked up by the Arduino but using the same exact code it works fine if I send a letter "D". I'm not able to read data at all from the serial port. I have the simple scripts below: <?php /* Script for testing receipt of data from Arduino */ // Load the serial port class require("php_serial.class2.php"); //Initialize the class $serial = new phpSerial(); $serial->deviceSet("COM4"); $serial->confBaudRate(9600); $serial->confParity("none"); $serial->confCharacterLength(8); $serial->confStopBits(1); $serial->deviceOpen(); $read = $serial->readPort(); // waiting for reply $led1 = $read; $led1 = (int)$led1; $serial->deviceClose(); ?> Code (markup): ARduino: // testing output to php const int ledPin = 2; void setup() { Serial.begin(9600); } void loop() { Serial.println("1"); //_control); digitalWrite(ledPin, HIGH); delay(50); digitalWrite(ledPin, LOW); delay(100); } Code (markup):
Cool project! Is this really the right forum for help though? Have you tried Googling about the php_serial class you're using? Where did you get it from?
I have tried...that's pretty much what led me to this site as there was an earlier reference to it but not related to this problem. Why wouldn't this forum be appropriate?