N
N
neskin2012-01-24 14:11:34
PHP
neskin, 2012-01-24 14:11:34

Arduino + PHP + Windows 7 64bit

I'm trying to implement Arduino control (blinking 13 ice) using PHP.

OS info: Windos 7 64bit, Arduino UNO, XAMPP (Apache running)

Problem: Can't control Arduino via PHP.

I use serial2socket
port 8080 there by default dl.dropbox.com/u/15881557/Screen%20shot%202012-01-23%20at%202.26.42%20PM.png - this is how the serial2proxy window looks like

php code:

<?php
$fp = fsockopen("127.0.0.1", 8080, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)
\n";
} else {
fwrite($fp, "1");

fclose($fp);
}
?>

I listen to 1 or 0 on the arduino, depending on this, I light 13 ice - but the problem is that the command passes through the proxy once, and on the second request it writes Refused connection from 127.0.0.1 as shown in the screenshot above, please tell me what could be the problem ?

Or what proxy to use?

Thanks in advance

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
neskin, 2012-01-24
@neskin

I found a solution: I
used serproxy, a small utility, the only one with a specific config setting for the COM13 port. Be sure to use version 0.14
Difference settings in
com_ports: 1,2,3,13
...
et_port13=5343

V
Vitaly Peretyatko, 2012-01-25
@viperet

You can also get rid of the COM-> SOCKET layer and communicate directly with the COM port from PHP. You can even use a library like code.google.com/p/php-serial/ so that the script then works not only under Windows.

N
neskin, 2012-01-25
@neskin

this library did not work for me either under Windows or under osx.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question