Controlling Arduino with PHP over serial...

Hello,
I am trying to make a ping pong ball launcher. I need a controller that allows me to move a stepper motor to three preset positions when I click a button on a webpage. I have made the Arduino code and circuit, and it works in that it responds when I send commands through the serial monitor.

Here is my current Arduino Code:

#include <Stepper.h>

int ledPin13 = 13; // the pin that the main LED is attached to
int incomingByte; // a variable to read incoming serial data into
Stepper myStepper(48, 9,10,11,12); //Set up 48 step stepper motor using pins 9,10,11,12

void setup() {

Serial.begin(9600); // initialize serial communication

pinMode(ledPin13, OUTPUT); // initialize the green LED pin as an output

myStepper.setSpeed(60); // 60 rpms

}
void loop() {

digitalWrite(ledPin13, HIGH); //Turn on the main LED

// see if there's incoming serial data:
if (Serial.available() > 0) {

incomingByte = Serial.read(); // read the oldest byte in the serial buffer

//Preform the code to switch on or off the leds

if (incomingByte == '0') {

myStepper.step(14); // moves the stepper 14 steps forward

delay(300); // wait half a second.

myStepper.step(-14); // moves the stepper 14 steps backward

}
if (incomingByte == '1') {
myStepper.step(7); // moves the stepper 7 steps forward
}

if (incomingByte == '2') {
myStepper.step(-7); // moves the stepper 7 steps backward
}

}
}

I need a webpage that has three buttons. One that says "Fire" and sends the value "0" through serial, one that says "Rapid Fire On" and sends the value "1" through serial, and one that says "Rapid Fire Off" and sends the value "2" through serial.

Does anyone know how I should go about this? I am familiar with HTML, but not PHP.

Thanks,
Andrew

Do you have PHP installed, configured, and known to be working?

Have you found and installed the PHP serial class?

What operating system are you using?

There are plenty of examples on the PHP site (php.org). PHP is a lot like C, so it isn't that hard to get a PHP script to send serial data, once you have the PHP serial class installed.

PaulS:
Do you have PHP installed, configured, and known to be working?

Have you found and installed the PHP serial class?

What operating system are you using?

There are plenty of examples on the PHP site (php.org). PHP is a lot like C, so it isn't that hard to get a PHP script to send serial data, once you have the PHP serial class installed.

Hi,
I have PHP installed and working using MAMP Server on my Mac. I have a the php_seroal.class.php file, but I did not know that I had to install it. How do you install a php class? I googled it, but could not find any information...

Thanks for all of the help.

Try this :TheByteWorks - Quality ready made and affordable custom software

Working on with XP and Windows 7 with XAMPP