esp-12 static IP-address

48 views
Skip to first unread message

guyc

unread,
Feb 6, 2017, 12:58:48 PM2/6/17
to souliss
I'm making my first steps with the ESP-module. The "Hello_World" example is running, but I have 2 questions.

When I get the database in the SoulissApp, I receive 2 nodes. Node0 (containing the slots) & Node1 (empty).

Each time when I restart the ESP, I receive another IP-address, because the ESP is asking an andress from the router. Is it possible to have a fix or static IP-address ? I tried the commantds that I use in the arduino with ENC28J60, but it doesn't work.

Jarek Andrzejewski

unread,
Feb 7, 2017, 7:57:49 AM2/7/17
to souliss
On Monday, February 6, 2017 at 6:58:48 PM UTC+1, guyc wrote:

Each time when I restart the ESP, I receive another IP-address, because the ESP is asking an andress from the router. Is it possible to have a fix or static IP-address ?

Hi,

Here are fragments of my gateway working code:

// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID               "WiFiSSID"
#define WiFi_Password           "WiFiPassword"  

// Include framework code and libraries
#include <ESP8266WiFi.h>

uint8_t ip_address[4]  = {192, 168, 1, 77};
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4]  = {192, 168, 1, 2};
#define Gateway_address 77
#define myvNet_address  ip_address[3] 
#define myvNet_subnet   0xFF00
#define myvNet_supern   Gateway_address

void setup() {  
    Souliss_SetIPAddress(ip_address, subnet_mask, ip_gateway);
    SetAsGateway(myvNet_address); 


    SetAddress(0xAB01, 0xFF00, 0x0000);
    SetAsPeerNode(0xAB02, 1);








guyc

unread,
Feb 7, 2017, 3:42:45 PM2/7/17
to souliss
Jarek,
Many thanks.
This solved my problem


Op dinsdag 7 februari 2017 13:57:49 UTC+1 schreef Jarek Andrzejewski:
Reply all
Reply to author
Forward
0 new messages