amirchaudhary 0 Posted November 24, 2014 Share Posted November 24, 2014 Hi, I have CC3200 launchpad and it is working fine with dynamic ip. Now i have to connect it to static ip and here the problems starts. I am using windows 7 32 and other pc with windows 7 64bit with energia to program it and i already formatted and install the new service pack. Now when i load wifigethostip it works cool and gives information as asked in the code but when i load static ip addressing sketch it does not connect with my router and it displays IP Adress as 0.0.0.0 Please guide to connect it to net using static ip address Attached is the code for both along with the serial monitor O/P WiFiGetHostIP /** * get host IP by hostname demo * * Type a hostname into the serial terminal * and the corresponding IP address will be printed * * By Noah Luskey: 2 July 2014 */ #ifndef __CC3200R1M1RGC__ // Do not include SPI for CC3200 LaunchPad #include <SPI.h> #endif #include <WiFi.h> // your network name also called SSID char ssid[] = "SarlaA"; // your network password char password[] = "thisishitech"; // your network key Index number (needed only for WEP) int keyIndex = 0; void setup() { // put your setup code here, to run once: Serial.begin(115200); Serial.println("**Simplelink IP by name demo**"); // attempt to connect to Wifi network: Serial.print("Attempting to connect to Network named: "); // print the network name (SSID); Serial.println(ssid); // Connect to WPA/WPA2 network. Change this line if using open or WEP network: WiFi.begin(ssid, password); while ( WiFi.status() != WL_CONNECTED) { // print dots while we wait to connect Serial.println("Searching..."); delay(300); } Serial.println("\nYou're connected to the network"); Serial.println("Waiting for an ip address"); while (WiFi.localIP() == INADDR_NONE) { // print dots while we wait for an ip addresss Serial.println("searching"); delay(300); } Serial.println("\nIP Address obtained"); // you're connected now, so print out the status printWifiStatus(); } #define STRLEN 32 char buffer[STRLEN]; int bufferIndex = 0; void loop() { while(Serial.available()) { buffer[bufferIndex] = Serial.read(); // is this the terminating not carriage return if( buffer[bufferIndex] != '\r') { // keep reading bufferIndex++; continue; } buffer[ bufferIndex ] = 0; // terminate the string with a 0 bufferIndex = 0; // reset the index ready for another string Serial.print("Getting IP for "); Serial.println(buffer); IPAddress IP(0,0,0,0); int iRet = WiFi.hostByName(buffer, IP); if(iRet < 0) { Serial.println("Host name lookup failed"); } else { Serial.println(IP); Serial.flush(); } } } void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print("Network Name: "); Serial.println(WiFi.SSID()); // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); // print the received signal strength: long rssi = WiFi.RSSI(); Serial.print("signal strength (RSSI):"); Serial.print(rssi); Serial.println(" dBm"); } #include <SPI.h> #include <WiFi.h> // the IP address for the shield: IPAddress ip(192, 168, 1, 12); char ssid[] = "SarlaAP5"; // your network SSID (name) char pass[] = "thisishitech"; // your network password (use for WPA, or use as key for WEP) int status = WL_IDLE_STATUS; void setup() { // Initialize serial and wait for port to open: Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { Serial.println("WiFi shield not present"); while(true); // don't continue } WiFi.config(ip); // attempt to connect to Wifi network: while ( status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); // Connect to WPA/WPA2 network. Change this line if using open or WEP network: status = WiFi.begin(ssid, pass); Serial.println(S) // wait 10 seconds for connection: delay(10000); } // print your WiFi shield's IP address: Serial.print("IP Address: "); Serial.println(WiFi.localIP()); } void loop () {} I have tried changing different ip address which are free but it does not connect to internet. Please guide!!!! Quote Link to post Share on other sites
amirchaudhary 0 Posted November 25, 2014 Author Share Posted November 25, 2014 I formated and loaded the new service pack, then i loaded WiFiGetHostIP sketch (first sketch) it worked fine and gave me output as in the first window but when i load sketch to connect it to a static ip it fails displays IP Adress as 0.0.0.0 Again repeated the procedure formated loaded new service pack and the wifigethostip it worked but agian when i loaded the static ip sketch it again says the same ip as 0.0.0.0. the Please guide !!!! Quote Link to post Share on other sites
amirchaudhary 0 Posted December 7, 2014 Author Share Posted December 7, 2014 Awaiting for the new version of energia 14 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.