Jump to content

talking to the serial port

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
aloishis89

aloishis89

    Newbie

  • Members
  • PipPip
  • 12 posts
I am trying to use php to talk to a microcontroller via the serial port. As far as I know, there are 3 ways of doing it: using fopen(), using the serial class, and using the serial extension. I know my microcontroller code works because I can manually send stuff over the serial port and it responds as expected. I want to send a single ascii character at a time. I just want to make sure that each of the methods work the way I think and was wondering if there are any more ways. Can you talk to the serial port just using fopen()? And can I just send over ascii characters with the serial class and serial extension? I have noticed that using the serial class takes much longer than the other 2 options.

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
In Linux you can do just about anything using fopen. I can't say the same for Windows. However, I can't begin to understand why you would want to do this using a programming language designed to implement websites.

#3
aloishis89

aloishis89

    Newbie

  • Members
  • PipPip
  • 12 posts
I am actually trying to control the serial port over the web, so I can remotely control my microcontroller. I am not limited to php, if there is a better way to do that, then I am certainly open to it.

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I would probably use a NetBurner Embedded Ethernet Board that directly supports TCP/IP. However, if you must use a PC as a middle man, C++ (CGI) would be your best bet, but Python is also fully capable of communicating with a serial port.