Commit d14bf741 authored by Anders Wallin's avatar Anders Wallin

define-option for fixed-IP or DHCP

parent 21b0f6f4
......@@ -21,13 +21,17 @@ requests.get("http://%s/SP6T%s:STATE:%d" % (ip, switch, state))
namespace HTTPD {
// 90:A2:DA:E7:F0:F3
// MAC address generated by https://ssl.crox.net/arduinomac/
// see http://blog.crox.net/archives/91-MAC-generator.html
byte mac[] = {
// 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
0x90, 0xA2, 0xDA, 0x0E, 0xCE, 0x76
byte mac[6] = { 0x90, 0xA2, 0xDA, 0xE7, 0xF0, 0xF3 };
};
// #define FIXED_IP // define this to use a fixed IP
#define DHCP_IP // to use DHCP
// if FIXED_IP, use this address
IPAddress ip(192, 168, 1, 18);
//IPAddress ip(192, 168, 3, 30);
//IPAddress ip(130, 188, 45, 253);
......@@ -47,11 +51,15 @@ httpd(RF_MUX::RF_MUX* m1, RF_MUX::RF_MUX* m2){
void init() {
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip); // fixed IP
//Serial.println("DHCP...");
//int dhcp_result = Ethernet.begin(mac); // DHCP result
//Serial.print("DHCP success? ");
//Serial.println(dhcp_result);
#ifdef FIXED_IP
Ethernet.begin(mac, ip); // fixed IP
#endif
#ifdef DHCP_IP
Serial.println("DHCP...");
int dhcp_result = Ethernet.begin(mac); // DHCP result
Serial.print("DHCP success? ");
Serial.println(dhcp_result);
#endif
server->begin();
Serial.print("MUX is at IP: ");
Serial.println(Ethernet.localIP());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment