0

I have a Arduino Uno and a CC3000 shield. When I run the example code for Webclient from Adafruits libary it works perfect.

When I switch out address for reading a corresponding text file from my own server the code completes sporadically. The output in the serial window stops at differens places every time.

Does anyone have any idea how I can fix this?

The Adafruit points to this URL: http://www.adafruit.com/testwifi/index.html While mine points to this URL: http://a.sjsd.li/test/test.html

  • Can you show the results you got? All your test page contains is 'hello world' so there should be no problems reading it from the server. What HTTP response do you get? – TisteAndii Jan 16 '16 at 13:13
  • The response header it HTTP/1.1 200 OK, here you got an example of failure: <!-- language: lang-sh --> HTTP/1.1 200 OK Server: Apache Last-Modified: Sat, 16 Jan 2016 11:38:42 GMT ETag: "c98e4d75-c-52971f630f480" Vary: Accept-Encoding Content-Type: text/html Transfer-Encoding: chunked Date: Sat, 16 Jan 2016 18:06:16 GMT X-Varnish: 1632177268 1632051084 Age: 71 Via: 1.1 varnish Conn – Helge Jan 16 '16 at 18:09
  • Edit your post to include the response PROPERLY FORMATTED, so we can know what's missing. Is this result consistent? Does the response always cut off at this point? – TisteAndii Jan 16 '16 at 22:15
  • Please edit your post to include the additional information requested. Select it and hit Ctrl+K to make it monospaced formatting. – Nick Gammon Jan 17 '16 at 3:45
  • Sorry for the bad formating of the code guys. It seems like I can't make it to work. Ctrl + K makes the foucs jumpt to the URL-field in Chrome. @brianrho No, sometimes it doesen't get this far. – Helge Jan 17 '16 at 12:09
1

I have arrived at a solution that works for me. Instead of using Adafruit library I have adopted Sparkfuns library.

Some adjustments in the setup for the pins:

#define CC3000_INT      3   // Needs to be an interrupt pin (D2/D3)
#define CC3000_EN       5   // Can be any digital pin
#define CC3000_CS       10  // Preferred is pin 10 on Uno
#define SD_CS           4   // Chip select for SD card

Then some adjustemnt in the block for the HTTP request:

client.print("GET /index.html HTTP/1.1\r\n");
client.print("Host: ");
client.print(server);
client.print("\r\n\r\n");
client.println();
Serial.println();

This is not a solution for the Adafruit libary. But it helped me to continue my project.

0

Perhaps the CC3000 isn't waiting long enough for the whole response to come in. Try increasing the variable IDLE_TIMEOUT in the Web_Client sketch, near the top. Change its value to 10000 and see if you get the whole response this time.

  • I have tried to to change the value. But it doesen't help at all. – Helge Jan 17 '16 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.