CC3000 ConnectTCP IP Question

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
yishi
 
Posts: 16
Joined: Fri Jan 31, 2014 12:10 am

CC3000 ConnectTCP IP Question

Post by yishi »

Hi,

For CC3000, I wonder is there a way for me to give value to ip directly?

I saw tons of examples of giving value to ip by this function "getHostByName(WEBSITE, &ip))"

But if I know the ip address, how do I give to ip without using "getHostByName"?

Thanks a lot!

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: CC3000 ConnectTCP IP Question

Post by tdicola »

Take a look at the cc3000 object's IP2U32 function. You can pass the 4 byte components of an IP address and get a uint32_t ip address directly. For example to grab the value for 192.168.1.100 call:

uint32_t ip = cc3000.IP2U32(192, 168, 1, 100);

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

Return to “Other Arduino products from Adafruit”