Is there easy way to put data from Arduino on web page?
I'm thinking of writing PHP script, which calls C# program, which communicates with Arduino.
So far i'm ok with sending data to Arduino, but what about receiving data?
Can i use C# to send data from specific port back to PHP and display it?
Generally speaking, if the arduino is to provide data to a requesting client, a server application is run on the arduino. If the arduino is to on its own to supply data to a server some where, a client application is run on the arduino. "Get" request seem to be the easiest way to pass limited data to/from an arduino.
POST isn't too much harder, and is technically more correct, given that you are likely to make some state change based on the Arduino data.
POST /arduino.php HTTP/1.1
Host: myhost
Content-Length: 29
Content-Type: application/x-www-form-urlencoded
pin2=HIGH&pin3=LOW&pin5=HIGH
This presumes you have some Ethernet hardware connected to your Arduino of course, to act as the server or client in this situation.
Are you using an Ethernet (or WiFi) shield, or do you plan to have your Arduino connected to a PC via USB/Serial?
No, no aditional shields.
I would like to read data only via USB connection. That's why i decided to get it with C#, but i'm not shure how to send them into php...
Like i said, PHP->C#->Arduino works ok, but i have no idea how to do it in reverse. Maybe i could write file (xml?) with C#, and read it with PHP.
That you are referring to C# and PHP together implies that you are using a Windoze operating system. The PHP serial class on Windoze has a serious deficiency (that seems to be unresolvable with an OS change that isn't likely to be made) that prevents it from reading from the serial port. So, PHP --> Arduino is possible, but Arduino --> PHP isn't.
I would like to read data only via USB connection.
Any language which supports serial ports can talk to the Arduino.
Alternatively you can use a virtual serial port to communicate with the Arduino over a network socket.
serproxy: http://www.lspace.nildram.co.uk/freeware.html
Null modem: http://com0com.sourceforge.net/
Both are free and both make it a little bit easier to deal with newer languages that do not have robust serial support (I'm looking at you PHP.)
(that seems to be unresolvable with an OS change that isn't likely to be made)
It is not an OS problem, it is a PHP problem. PHP was made to do file handling and not to do hardware IO. ![]()