-
-
Notifications
You must be signed in to change notification settings - Fork 11
Advanced Topics
Giorgioggì edited this page Jan 10, 2021
·
2 revisions
The FixedIPAddress example shows how to use a static IP address instead of DHCP. It all boils down to this:
IPAddress ip (IP_ADDRESS);
IPAddress dns (DNS_ADDRESS);
IPAddress gw (GW_ADDRESS);
IPAddress mask (NETMASK);
Serial.println (F("Configuring static IP address"));
#if defined (WEBBINO_USE_ENC28J60) || defined (WEBBINO_USE_WIZ5100) || \
defined (WEBBINO_USE_WIZ5500)
byte mac[6] = {MAC_ADDRESS};
bool ok = netint.begin (mac, ip, dns, gw, mask);
#elif defined (WEBBINO_USE_ENC28J60_UIP)
byte mac[6] = {MAC_ADDRESS};
bool ok = netint.begin (mac, ip, dns, gw, mask, SS_PIN);
#elif defined (WEBBINO_USE_ESP8266) || defined (WEBBINO_USE_ESP8266_STANDALONE)
#error "ESP8266 does not currently support static IP configuration"
#elif defined (WEBBINO_USE_FISHINO)
bool ok = netint.begin (WIFI_SSID, WIFI_PASSWORD, ip, dns, gw, mask);
#elif defined (WEBBINO_USE_WIFI) || defined (WEBBINO_USE_WIFI101)
#error "WiFi/WiFi101 does not currently support static IP configuration"
#elif defined (WEBBINO_USE_DIGIFI)
#error "Static IP configuration for DigiFi must be set in its own interface"
#endif
Note that using a fixed address is NOT supported on all platforms.
The Ajax example is a very simple example of how to use AJAX techniques. It's actually pretty useless, as everything is done in the HTML, Webbino does not need anything special to support this.
#ifdef in HTML