Jump to content

Recommended Posts

Hi , I have written a code for ethernet client using TM4c1294NCPDT launchpad and I am sending data to a server at api.pushingbox.com. The code sends data to the server after every 15 seconds, It works all the time, however sometimes suddenly the ethernet data transfer hangs, the microcontroller does not hang. Below is the void loop() I have used.Please help.

void loop(){ 

   kemasData(); //packing GET query with data
   if (client.connect(server, 80)) {
//     koneksi = true; //connected = true
       length = 0;
          Serial.println("conn serv");

     Serial.println("connection failed");
  // loop

    while (client.available()) {
 char c = client.read(); //save http header to c
 Serial.print(c); //print http header to serial monitor


  if (!client.connected()) {

          Serial.print("Count :");
          Serial.println(u.count); //print sent value to serial monitor
          Serial.println("Client Stopped");
//          koneksi = false; 
          Serial.println("koneksi = false");
          data = ""; //data reset
  delay(15000); // interval
When I check the serial port the code hangs at conn serv printed above.
Edited by bluehash
[ADMIN] Please use code tags <> next time.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...