CC3000 basics

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Stefano2800
 
Posts: 2
Joined: Fri Feb 05, 2016 2:29 am

CC3000 basics

Post by Stefano2800 »

I was trying to study the CC3000 library using the http sever example and I have few questions.
Please forgive my inexperience I am learning.

1)

Code: Select all

Adafruit_CC3000_Server httpServer(LISTEN_PORT); 
is an istance from the Adafruit_CC3000_Server.h, correct? Why I do not see the include for it?

2)

Code: Select all

uint8_t buffer[BUFFER_SIZE+1];
why the uint8_t type is used and not char? I changed the data type into char, the program seems to work and I can print the full buffer on the serial monitor, it helped me to understand the parsing as I had no idea of what the browser was sending... With the uint8_t type on the serial monitor I was printing the decimal value for the ASCII. Why "buffer" appears in orange on my Arduino IDE? is it a keyword?

3) I do not see the following printed on my browser, what could be the cause?

Code: Select all

client.fastrprintln(F("HTTP/1.1 200 OK"));
        // Then send a few headers to identify the type of data returned and that
        // the connection will not be held open.
        client.fastrprintln(F("Content-Type: text/plain"));
        client.fastrprintln(F("Connection: close"));
        client.fastrprintln(F("Server: Adafruit CC3000"));
The following are printed:

Code: Select all

client.fastrprintln(F("Hello world!"));
 client.fastrprint(F("You accessed path: ")); client.fastrprintln(path);
But they are all part of the same if statement, I should see all or noting correct? or it depends on browser settings?

4)

Code: Select all

Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT, SPI_CLOCK_DIVIDER);
If I understand correctly this should be the definition of cc3000 object for the Adafruit_CC3000 class plus the call for the Adafruit_CC3000 method correct?
I tried to rewrite as follows but did not work:

Code: Select all

 Adafruit_CC3000 cc3000;
cc3000.Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT, SPI_CLOCK_DIVIDER);
5) I cannot connect to my CC3000 using http://arduino.local, I need to type the IP 192.168.100.8, why? how can I fix it?

6) this is more difficult, is it possible to access the cc30000 from remote I mean when I am away I would like to connect to it from internet.

Please help.
Thank you.
“The man who asks a question is a fool for a minute, the man who does not ask is a fool for life.” Confucius

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: CC3000 basics

Post by adafruit_support_mike »

1) The server class is declared in the same header file as the client class.

2) uint8_t explicitly tells the compiler you want an unsigned 8-bit integer. These days some compilers consider 'char' to be a 16-bit Unicode mapping. For machines that do still treat chars as 8-bit uints, it's a case of po-tay-to/po-tah-to.

3) Those are headers. The browser needs the information to know how to handle the rest of the data, but doesn't display them on the page. All servers emit the same headers, and all browsers use the information without displaying it.

4) In C++ the initializer is a special function called when memory space for the object is first allocated. It behaves differently from other object methods, and one of the differences is that you have to call it when the object is created.

5) 'arduino.local' is a human-readable machine name. 192.168.100.8 is an IP address. Network cards only know how to use IP addresses, and need to contact an external server to map human-readable names to IP addresses. It's the same disctinction as a phone -- which only knows how to route calls using phone numbers -- and a phone book.

The .local domain is handled by a protocol called MQTT that allows machines to handle name-to-address requests for their own names when the query is made on the local network. If your Arduino isn't listening for MQTT requests and providing address mappings for its name, your computer has no way of knowing that 'arduino.local' has any association with '192.168.100.8'.

6) That would require what's known as an 'externally visible IP address'. To get one of those, you'll need to talk to your phone company.

User avatar
Stefano2800
 
Posts: 2
Joined: Fri Feb 05, 2016 2:29 am

Re: CC3000 basics

Post by Stefano2800 »

Thank you very much for the clarification.
I have another question, I would like to communicate to CC3000 using an application created with Processing, a primitive GUI.
I haven't tried yet but I believe that sending the HTTP request should be quite straightforward, but to receive answers might not be so.
Probably this is not the right place to ask but, can you give me a hint?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”