Hi.
I've tried to make some code so i could communicate with the Arduino, which then communicates with the Ethernet board and send what it recieves from the Serial.
This is my code, but it doesn't work:
#include <Ethernet.h>
// network configuration. gateway and subnet are optional.
byte mac[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
byte ip[] = { 192, 168, 1, 111 };
int receivedByte = 0; // Used when recieving HTTP DATA from uC
Server server = Server(80);
unsigned long time;
void setup()
{
// initialize the ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
Serial.begin(9600); // setup serial
}
void loop()
{
Client client = server.available();
if (client) {
Serial.print(2, BYTE); //Tell that a client has connected
while (!Serial.available()) {
// Wait on what to send
}
while (Serial.available()) {
receivedByte = Serial.read();
Serial.print(receivedByte);
//server.print(receivedByte);
}
client.stop();//close the connection with the client
delay(1000);//pause wait for a new connection
}
}