Hi,
I have written a ethernet server based on the code found in net.
Sakura is not responding for the ethernet frames from client. I am using offline compiler
Code ::
#include <rxduino.h>#include <Ethernet.h>#define INTERVAL 100byte mac[] = {0x08, 0x09, 0x3c, 0x12, 0x34, 0x56};byte ip[] = {192,168,0,2};TEthernet Ethernet;EthernetServer server (80);void setup(){ pinMode(PIN_LED0,OUTPUT); pinMode(PIN_LED1,OUTPUT); pinMode(PIN_LED2,OUTPUT); pinMode(PIN_LED3,OUTPUT); Serial.begin(115200,SCI_SCI0P2x); Ethernet.begin(mac,ip); Serial.write("Ethernet done \n");Serial.print("My IP address is: "); Serial.println(Ethernet.localIP()); server.begin(); Serial.write("Server begin done \n"); /*speed: Baud rateThe port: port to be used (if omitted, use the virtual COM port of USB0)I use a virtual COM port USB0: SCI_USB0I use the (TxD) (RxD), pin 30 pin 31 SCI_SCI2AI use the (RxD) (TxD), pin 26 SCI_SCI2B pin 24. Used to access XBeeI use the (RxD) (TxD), Pin 6 Pin 7 SCI_SCI6BI use the (TxD) (RxD), pin 1 SCI_SCI0P2x pin 0Select the one it received for the first time in USB0 or SCI_AUTO pin 0,1*/Serial.write("Setup done \n");}void loop(){EthernetClient client; client = server.available (); if (client) { // got client? boolean currentLineIsBlank = true; digitalWrite(PIN_LED0, 1); delay(INTERVAL); while (client.connected()) { digitalWrite(PIN_LED1, 1); delay(INTERVAL); if (client.available()) { // client data available to read char c = client.read(); // read 1 byte (character) from client // last line of client request is blank and ends with \n // respond to client only after last line received digitalWrite(PIN_LED2, 1); delay(INTERVAL); if (c == '\n' && currentLineIsBlank) { digitalWrite(PIN_LED3, 1); delay(INTERVAL); // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); client.println(); // send web page client.println("<!DOCTYPE html>"); client.println("<html>"); client.println("<head>"); client.println("<title>GK-Sakura Web Page</title>"); client.println("</head>"); client.println("<body>"); client.println("<h1>Hello from GK-Sakura!</h1>"); client.println("<p>A web page from the GK-Sakura server</p>"); client.println("</body>"); client.println("</html>"); break; } // every line of text received from the client ends with \r\n if (c == '\n') { // last character on line of received text // starting new line with next character read currentLineIsBlank = true; } else if (c != '\r') { // a text character was received from client currentLineIsBlank = false; } } // end if (client.available()) } // end while (client.connected()) delay(1); // give the web browser time to receive the data client.stop(); // close the connection } // end if (client)// Serial.write("LOOP\n");}
Hello,
I have tried so many time in ON line and OFF line complier Ethernet doesn't work.Please tell me any hardware changes is there.
There is no hardware change involved. Whatever code runs on the ON line compiler will also run on the OFF line compiler.
yes Abdeali is correct.......code should run for both Offline and online
I suspect the libraries used will make the difference in case of offline and online compilers.
With offline size of the sketch.bin is 93kb
with online size was 97kb.
Is there any way to update the offline compiler lib to latest?
Please any one give me Ethernet udp code or give me some idea
How to find MAC ID of the module ?
Sorry to delay reply.
GR-SAKURA has no MAC address itself.
So in case of prototyping using them, specify your MAC like sample of Arduino.
www.arduino.cc/.../WebClient
U/L bit in 1st octet should be specified 1.
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
~~~~