12 Replies Latest reply on Jan 17, 2015 1:28 AM by joyalonscreen

    Problem running simplewifi example sketch


      Hey folks,

         I was trying to use the example simplewifi sketch to run on edison but no luck. I have configured the SSID and Passwd for edison and connected to wifi, all my local browser works fine. But when I run the sketch, it keeps trying to access the SSID but not able to connect. Am I doing anything wrong here? Any tips/hints? Also I am on the 56th version of the flash image.

        • 1. Re: Problem running simplewifi example sketch

          Hi Enthusiast_blogger_abhi;


          When you say SimpleWifi sketch do you mean the "SimpleWebServerWifi" sketch?




          • 2. Re: Problem running simplewifi example sketch

            Yes you are right. I see in the serial port, messages trying to connect to network but no success.

            • 3. Re: Problem running simplewifi example sketch

              After reading through the community,caught few solutions to get my wifi connected when running the simpleWebserverwifi sketch. But when I open up the browser and click link to turn on or turn off, I see this below message and no response from the led on the board. Any hints?


              client disonnected

              new client

              GET /favicon.ico HTTP/1.1


              Connection: keep-alive

              Accept: */*

              User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36

              Accept-Encoding: gzip,deflate,sdch

              Accept-Language: en-US,en;q=0.8

              • 4. Re: Problem running simplewifi example sketch

                I haven't tested the sketch yet.. but other users have had problems using the Wifi library in response that the library is made for Arduino UNO shields, so that could be giving you problems, you could try to interact with the wifi settings using the Linux terminal and using Node.js, that is often used for network applications.

                • 5. Re: Problem running simplewifi example sketch

                  With all respect, I find the answer "ignore the software we ship with the system and try some diametrically different approach" unsatisfying.  If the WiFi example doesn't work, we shouldn't ship it.  If it ships, it should work.


                  The example actually does almost work.  It mostly just has a lot of irrelevant fluff that should be taken out.  Also, by default my Edison is already hosting a settings page on port 80, so you might either need to kill that daemon or use a different port.  I've modified the example to work by doing three things:


                  1) Changed the port from 80 to 83.

                  2) Changed the LED from 9 to 13 (the built-in one for Edison).

                  3) removed much extraneous code



                    WiFi Web Server LED Blink


                  A simple web server that lets you blink an LED via the web.


                  If the IP address of your shield is yourAddress:

                  http://yourAddress:83/H turns the LED on

                  http://yourAddress:83/L turns it off



                  * Edison

                  * LED attached to pin 13


                  created 25 Nov 2012

                  by Tom Igoe

                  mods by Mikal Hart 11/13/2014


                  #include <SPI.h>

                  #include <WiFi.h>


                  int status = WL_IDLE_STATUS;

                  WiFiServer server(83);


                  void setup() {

                    Serial.begin(9600);      // initialize serial communication

                    pinMode(13, OUTPUT);      // set the LED pin mode


                    server.begin();                           // start the web server on port 80



                  void loop() {

                    WiFiClient client = server.available();   // listen for incoming clients


                    if (client) {                             // if you get a client,

                      Serial.println("new client");           // print a message out the serial port

                      String currentLine = "";                // make a String to hold incoming data from the client

                      while (client.connected()) {            // loop while the client's connected

                        if (client.available()) {             // if there's bytes to read from the client,

                          char c = client.read();             // read a byte, then

                          Serial.write(c);                    // print it out the serial monitor

                          if (c == '\n') {                    // if the byte is a newline character



                            // if the current line is blank, you got two newline characters in a row.

                            // that's the end of the client HTTP request, so send a response:

                            if (currentLine.length() == 0) {

                              // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)

                              // and a content-type so the client knows what's coming, then a blank line:  

                              client.println("HTTP/1.1 200 OK");




                              // the content of the HTTP response follows the header:

                              client.print("Click <a href=\"/H\">here</a> turn the LED on pin 13 on<br>");

                              client.print("Click <a href=\"/L\">here</a> turn the LED on pin 13 off<br>");


                              // The HTTP response ends with another blank line:


                              // break out of the while loop:



                            else {      // if you got a newline, then clear currentLine:

                              currentLine = "";



                          else if (c != '\r') {    // if you got anything else but a carriage return character,

                            currentLine += c;      // add it to the end of the currentLine



                          // Check to see if the client request was "GET /H" or "GET /L":

                          if (currentLine.endsWith("GET /H")) {

                            digitalWrite(13, HIGH);               // GET /H turns the LED on


                          if (currentLine.endsWith("GET /L")) {

                            digitalWrite(13, LOW);                // GET /L turns the LED off




                      // close the connection:


                      Serial.println("client disonnected");



                  • 6. Re: Problem running simplewifi example sketch

                    More directly to Enthusiast's question, the onboard LED is LED 13 and not 9.

                    • 7. Re: Problem running simplewifi example sketch

                      I have tried changing the LED to 13, but probably I will try again updating the server port other than 80.

                      • 8. Re: Problem running simplewifi example sketch

                        Hmm.  The fact that you got the confirmation message in your serial console suggests that the page was in fact being loaded.  The LED pin 9 is (unfortunately) hard coded in several places in the source.  Make sure you change all of them to 13.

                        • 9. Re: Problem running simplewifi example sketch

                          Thanks mikalhart,

                          your answer solved it all. It also works with PIN 9 but not with port 80. Could you, please, explain why port 80 doesn not work with this example and infacts opens the device information page?



                          • 10. Re: Problem running simplewifi example sketch

                            @Scar75, yeah, I believe there is already a webserver daemon running on port 80.

                            • 11. Re: Problem running simplewifi example sketch

                              hey i tried to run the same code but i get only

                              SSID: NIGHTM@RE

                              IP Address: 192.168.  0.107

                              signal strength (RSSI):-38 dBm

                              To see this page in action, open a browser to http://192.168.  0.107


                              on the serial window...can u help me please..