Arduino, RPi & PHP help! (2-way serial comm)

hey Robin2-

HAHA.. I understand.. (its not for everyone!) :slight_smile:

However, it is what I am most comfortable with for server side web programming/development & DB interaction.

Using it for serial communication is a bit of a stretch I'm sure...

however 'writing' is no problem.. and from research 'reading' should not be an issue if not on a Windows platform.

I am not sure if the serial port remains open until specifically 'closed' or not....

(I'm also not clear if I need to 'open' it (again) in the external php script executed by the AJAX call)..

  • which I believe I -am- doing.. (wasnt sure if I need to open it again from the external script or if it just remains open and usable by 'whatever is coming down the pipe' (so to speak)... until closed. I am not 'closing' the port in either script currently.. lines are commented out)..

I'm not really sure where to start or go about trouble shooting here. LOL..

I think the the first is how to 'correctly' read the serial port using PHP.. (and make sure the port is configured correctly as well?)

Since I was told 'RPi/Linux' treats everything like a 'file'.. then !eof (not end of file) should work for the serial port.

  • Ah-Ha moment as I type.....

Do I need to be sending an 'end of file' character back from the Arduino to trigger the PHP while() function to complete?

(off to read up on that more).......

  • perhaps there is a better method to read the port than my approach?