Page 1 of 1

Static IP

PostPosted: Fri Oct 03, 2014 12:12 am
by wpfundstein
Hi,

i am working with mbed and i want to set static ip. how can i set static ip?

Thanks,

Re: Static IP

PostPosted: Sun Oct 05, 2014 9:44 pm
by Carl-SolderSplash
Hi,

Use the other init function :

void cc3000::init(const char *ip, const char *mask, const char *gateway)

Supply that with your static ip, mask and gateway address each being 4 byte arrays

Re: Static IP

PostPosted: Tue Oct 21, 2014 8:21 pm
by wpfundstein
Hi,

thanks for answer, but it does not work.

Sample:

my_ip[0] = 192;
my_ip[1] = 168;
my_ip[2] = 80;
my_ip[3] = 144;

my_nm[0] = 255;
my_nm[1] = 255;
my_nm[2] = 255;
my_nm[3] = 0;

my_gw[0] = 192;
my_gw[1] = 168;
my_gw[2] = 80;
my_gw[3] = 1;

//wifi.init();
wifi.init(my_ip, my_nm, my_gw);

the init functions hangs!

Werner

Re: Static IP

PostPosted: Tue Oct 21, 2014 10:02 pm
by Carl-SolderSplash
Hi,

Try the following :
Code: Select all
uint8_t my_ip[4] = {192, 168, 1, 144};
uint8_t my_nm[4] = {255, 255, 255, 0};
uint8_t my_gw[4] = {192, 168, 0, 1};
uint8_t my_dns[4] = {8, 8, 8, 8};

wifi.start(0);
wifi._netapp.dhcp((uint32_t *)&my_ip[0], (uint32_t *)&my_nm[0], (uint32_t *)&my_gw[0], (uint32_t *)&my_dns[0]);
wifi.restart(0);


I've just tested this on mbed and it appears to work.

Re: Static IP

PostPosted: Wed Oct 22, 2014 11:43 am
by wpfundstein
Thanks, this works.

Werner

Re: Static IP

PostPosted: Wed Oct 22, 2014 11:46 am
by Carl-SolderSplash
Super!