Control Arduino Using PHP
Control Arduino Using PHP
Table of Contents
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
http://www.instructables.com/id/Control-Arduino-using-PHP/
Intro: Control Arduino using PHP
I have recently seen a lot of problems regarding PHP and Arduino. Many people don't know about facts like that an arduino needs a 2 second (!!!) delay before it can
receive any messages through serial. There are a few other facts you need to pay attention to, I will be going over them in this instructable.
To install LAMP on debian (Ubuntu, turnkey, RPI, etc.) you want to execute the following command:
If you are not running Linux you don't have to run this command, in fact, you can't.
For other linux distributions you are going to have to check its documentation (same for osx).
Extract the zip and get copy the file src/PhpSerial.php to your %SERVERROOT%/www/ directory
#include "USBSerial_main.h"
void setup() {
void loop() {
http://www.instructables.com/id/Control-Arduino-using-PHP/
if(Serial.available() > 0){
This is easier when you are on unix-based systems, then you can just use fopen (check the php docs on that)
<?php
$msg = '';
if(isset($_POST["hi"])){
$serial->deviceSet($comPort);
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->deviceOpen();
sleep(2); //Unfortunately this is nessesary, arduino requires a 2 second delay in order to receive the message
$serial->sendMessage("Well hello!");
$serial->deviceClose();
?>
<html>
<head>
<title>Arduino control</title>
</head>
<body>
<form method="POST">
</form><br>
<?=$msg?>
</body>
</html>
http://www.instructables.com/id/Control-Arduino-using-PHP/
Related Instructables
Control an
How To Get Transform Paperduino Tiny
Arduino with
Started With Ubuntu 8.04 To (Photos) by
PHP by
Linux by Chad Look Like Mac
Arduino to How to connect aloishis89 ok1cdj
Baxter OSX by
Processing: Arduino to a PC
KenGriffin
Serial through the
Communication serial port by
without Firmata dvdllms87
by danm_daniel
Advertisements
Comments
2 comments Add Comment
http://www.instructables.com/id/Control-Arduino-using-PHP/