No DHCP i need solid ip adress

Hello , i use router with DHCP MODE OFF because i want no changing ip addresses…

but now my spark core only blink fast blue :frowning: is it possible to configure ip address solid without dhcp?

my code:

// Oma_02 // Wird Pin_D0 “HIGH” dann wird eine push_Nachricht gesendet. Version 1.1 Marc Rudorfer
// Mit 433Mhz anbindung an Wetterstation (Basisstation 1). Und deren Auswertung zu Temperatur und Regen.

int incomingByte;

const char * DEVID1 = “vF1F2377B7C07D1C”; // “bei PushingBox.com Scenario code erstellen und hier einfügen” (Oma_versucht_aufzustehen).
const char * DEVID2 = “vCF39F9B1E79B3FA”; // “bei PushingBox.com Scenario code erstellen und hier einfügen” (Es regnet).
const char * DEVID3 = “v4AF3168D1527B8F”; // “bei PushingBox.com Scenario code erstellen und hier einfügen” (Temperatur mehr als 30,00 Grad).

const int buttonPin = D0; // Pin an dem der Button angeschlossen ist. Pin über 4,7kOhm auf GND. pin -> auf 3,3v wechselt.
// Wird über Relais gesteuert.
boolean DEBUG = true;

int LED = D7; // LED zeigt Status an. (nachricht gesendet oder nicht. Led blau Pin_“D7”).
const char * serverName = “api.pushingbox.com”; // PushingBox API URL

int buttonState = 0; // Variable zu lesen des Pin_Status.

TCPClient client;

void setup() {

Serial1.begin(9600);

pinMode(LED, OUTPUT);                                               // LED als Output festlegen.

pinMode(buttonPin, INPUT);                                          // buttonPin als Eingang festlegen.


delay(1000);                                                        // Pause (1 Sekunde).


}

void loop() {

buttonState = digitalRead(buttonPin); // Pin Status lesen.

if (buttonState == HIGH) {

                  sendToPushingBox(DEVID1);                         // auslösen des oben declarierten ersten Scenarios. 


delay(60000);                                                       // Pause um Fehlarlarme zu vermeiden.

}

else {

}

if (Serial1.available() > 0) {

incomingByte = Serial1.read();

 if (incomingByte == 'R') {
     
     sendToPushingBox(DEVID2);
     
     delay(60000);
     
     
    
} 


 if (incomingByte == 'T') {
     
     sendToPushingBox(DEVID3);
     
     delay(60000);
    
} 

}

}

void sendToPushingBox(const char * devid) {

digitalWrite(LED, HIGH);                                             //  LED einschalten


client.stop();

if(DEBUG){

}
if (client.connect(serverName, 80)) {

if(DEBUG){

}

client.print("GET /pushingbox?devid=");
client.print(devid);
client.println(" HTTP/1.1");
client.print("Host: ");
client.println(serverName);
client.println("User-Agent: Spark");
client.println();
client.flush();

if(DEBUG) {
  
   
    }
    
    digitalWrite(LED, LOW);                                          // LED ausschalten.
    
} else {
  
    digitalWrite(LED, HIGH);                                         // LED einschalten, falls LED dauerhaft an ist war die letzte Verbindung fehlerhaft!
    
    if(DEBUG){
  }
}

}

Regards from Germany :wink:

@MarcGermany, the CC3000 wifi module on the Core REQUIRES DHCP to get an IP address and at this time, setting a fixed IP on the Core is not possible. To avoid “floating” addresses using DHCP simply “reserve” a specific IP for each device you have. Usually reservation requires the device’s MAC address (which is unique) and you simply associate (reserve) that MAC with a specific IP. Then when the device call the DHCP server for an IP, it will get the reserved IP every time. :smile:

the cc3000 can do static ip, adafruit got it going i believe.

also static dynamic as @peekay123 describes is no good if you don’t have control of the router you’re connecting to (e.g. cybercafe/corporate) or like myself and @MarcGermany - you don’t want to enable dhcp.

@sej7278, at this time the Spark does not have support for static IP though I believe it is being looked at. The assumption I made with @MarcGermany was that he was using a home router and did not necessarily understand the DHCP reservation concept. I am not sure why you would not want to enable DHCP on a home router?

i try the reservation concept. but for me it is not working fine… i am using 1 router , 1 repeater and many internet based things and with dhcp and address reservation i have many problems…

so I use solid ip addresses …

Hi Marc,

Maybe you can set your router to give devices with specific MAC addresses a defined IP address. I do this with my RaspPi which I use as webserver.

i’ve done it! proof of concept here

@sej7278, you link is no working :wink:

1 Like

forum added http:// on, works now