NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Iphone / RC car help!!!!

October 03, 2010
by Tripp
Tripp's Avatar

I am trying the iPhone to control the RC car project.

I installed the Apache webserver and loaded files car.php and vector.php to /htdocs. I've also wired the R/C and programmed the microcontroller.

I have 2 problems: 1) when I access (my ip)/car.php... Safari says it cannot open the page 2) How do you make a 'named pipe' on Windows?

Can anyone provide step by step on what you did to complete the project and the code used?

October 03, 2010
by Tripp
Tripp's Avatar

Ok, I am able to bring up car.php on my iphone (I was typing the wrong ip)

Now, I just need to know how to create a 'named pipe' in windows.

Any ideas?

October 03, 2010
by Tripp
Tripp's Avatar

I think I have figured it out. I will create a python socket server to make PHP and Python talk. I'm thinking something like this.

import socket
mySocket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
mySocket.bind ( ( '', 2727 ) )
mySocket.listen ( 5 )
while True:
    channel, details = mySocket.accept()
    print 'We have opened a connection with', details
    txt = channel.recv ( 100 )
    print txt
    channel.send ( "This is a response test - attempt 1\0" )

Any ideas, or suggestions?

October 04, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Tripp,

It looks like you have exactly the right idea on the python side. I think you want to move the

mySocket.listen ( 5 )

call inside the while loop. That way you will process one connection, then wait for the next one to come through from the php script.


December 04, 2011
by saluberful
saluberful's Avatar

Actually, you only need to call mySocket.listen(5) once. It's part of the server config and basically says the server can hold up to 5 clients in its queue.

Post a Reply

Please log in to post a reply.

Did you know that you can follow NerdKits on Facebook, YouTube, and Twitter? Learn more...