Static IP

A 40 Pin Dip packaged development board enabling you to create internet connected products

Static IP

Postby wpfundstein » Fri Oct 03, 2014 12:12 am

Hi,

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

Thanks,
wpfundstein
 
Posts: 7
Joined: Fri Oct 03, 2014 12:08 am

Re: Static IP

Postby Carl-SolderSplash » Sun Oct 05, 2014 9:44 pm

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
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Static IP

Postby wpfundstein » Tue Oct 21, 2014 8:21 pm

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
wpfundstein
 
Posts: 7
Joined: Fri Oct 03, 2014 12:08 am

Re: Static IP

Postby Carl-SolderSplash » Tue Oct 21, 2014 10:02 pm

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.
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Static IP

Postby wpfundstein » Wed Oct 22, 2014 11:43 am

Thanks, this works.

Werner
wpfundstein
 
Posts: 7
Joined: Fri Oct 03, 2014 12:08 am

Re: Static IP

Postby Carl-SolderSplash » Wed Oct 22, 2014 11:46 am

Super!
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm


Return to WiFi DipCortex

Who is online

Users browsing this forum: No registered users and 1 guest

cron