I have a java server on local host, that sets the status of LCD either 0 or 1.
the resource URI is: http://localhost/mytrain/restserver/train/lcd
and the content of the page is: {“lcdStatus”: 0} or {“lcdStatus”:1}
I’m trying to make my Arduino HTTP client reads it, and depending on the value 0 or 1 to control an LCD.
But it’s not working… When it gives an answer, then it’s ÿ
Could anyone please help me here? what should I write in the GET request?
My Arduino is Mega 2560, with Ethernet shield
Is the server accessible from the localnet, or just as localhost. localhost is a local server ip (normally 127.0.0.1) accessible only from web browsers on the server.
I just noticed, that when I give the URI in web browser, it asks me for user name and password,
how can I do this in Arduino, I mean to authenticate on the server?
maimi:
I just noticed, that when I give the URI in web browser, it asks me for user name and password,
how can I do this in Arduino, I mean to authenticate on the server?
The Arduino doesn’t have a web browser. The Arduino localhost (127.0.0.1) is the Arduino.
yea, it's the same.. well, it's a little complex..
I have a java program on the ip 192.168.1.1 which reads a serial port (received by XBee), and send the received data to an REST server with Tomcat on local host , which serves a website..
I want to send the same received data to another Arduino with Ethernet to control a LCD. With sockets, it didn't work.. there were many conflicts, so I thought of sending the data to the Rest server to an URI, and to call the URI from Arduino.
I guess, so the right server IP is localhost in this situation.. Cause I'm connecting to the rest server, and not the serial java program on 192.168.1.1
maimi:
how can I enter credentials with Arduino code?
It depends what sort of authentication the web site supports. There are lots of different ways, and they would need different implementations on the Arduino side.