简体   繁体   中英

Arduino Uno Wifi library not working

I have recently purchased an Arduino Uno WIFI. It says it already has the ESP8266 wifi module integrated making it WIFI ready. I have successfuly connected to my wifi and wifi console. I have also used the test WebServer Blink test to play around with the pin 13 rest api commands. The problem im having is going beyond this example. I searched for WIFI documentation but can only find this documentation for the WIFI-Shield which is not working for my arduino.

I see in the example they import the #include <ArduinoWiFi.h> but i cannot find this libraries documentation. Is there anyother library I can use with this new arduino wifi? Does anyone have experience with this? I have tried to use the #include <WIFI.h> but it says that I don't have the wifi sheild.

ERROR:

WebServerBlink.ino:14:23: error: 'class ArduinoWifiClass' has no member named 'status'

CODE:

#include <Wire.h>
#include <ArduinoWiFi.h>

/*
on your borwser, you type http://<IP>/arduino/webserver/ or http://<hostname>.local/arduino/webserver/

http://labs.arduino.org/WebServerBlink

*/
void setup() {
    pinMode(13,OUTPUT);
    Wifi.begin();
    Wifi.println("WebServer Server is up");
    Wifi.println(Wifi.status()); //Line 14:23:: This will not work
}
void loop() {

    while(Wifi.available()){
      process(Wifi);
    }
  delay(50);
}

void process(WifiData client) {
  // read the command
  String command = client.readStringUntil('/');

  // is "digital" command?
  if (command == "webserver") {
    WebServer(client);
  }

  if (command == "digital") {
    digitalCommand(client);
  }
}

void WebServer(WifiData client) {

          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<html>");

          client.println("<head> </head>");
          client.print("<body>");

          client.print("Click<input type=button onClick=\"var w=window.open('/arduino/digital/13/1','_parent');w.close();\"value='ON'>pin13 ON<br>");
          client.print("Click<input type=button onClick=\"var w=window.open('/arduino/digital/13/0','_parent');w.close();\"value='OFF'>pin13 OFF<br>");

          client.print("</body>");
          client.println("</html>");
          client.print(DELIMITER); // very important to end the communication !!! 

}

void digitalCommand(WifiData client) {
  int pin, value;

  // Read pin number
  pin = client.parseInt();

  // If the next character is a '/' it means we have an URL
  // with a value like: "/digital/13/1"
  if (client.read() == '/') {
    value = client.parseInt();
    digitalWrite(pin, value);
  }

  // Send feedback to client
  client.print(F("Pin D"));
  client.print(pin);
  client.print(F(" set to "));
  client.print(value);
  client.print(EOL);

}

There is a big difference between Arduino Uno WIFI ( http://www.arduino.org/products/boards/arduino-uno-wifi ) from arduino. org and the Arduino WiFi Shield (www.arduino.cc/en/Main/ArduinoWiFiShield) from arduino. cc .

This is a good starting point for your Arduino Uno WIFI: http://www.arduino.org/learning/getting-started/getting-started-with-arduino-uno-wifi

The next important point is, that you need to use Arduino 1.7 (from arduino.org) especially for OTA programming. Arduino 1.6.x from arduino.cc doesn't work.

Unfortunately they don't really develop their arduinowifi-library well.

I had the same problem on Linux IDE 1.8.1 and I solved it like this:

get https://github.com/arduino-org/Arduino/tree/master/libraries/ArduinoWiFi add it in .....arduino-1.8.1/libraries/ArduinoWiFi/ restart the IDE. You shall be able to open and run the example sketch under File->Examples->ArduinoWiFi.

I suppose that it will work with any IDE on any platform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM