How to get the Wifi working using Arduino?

Discussion in 'UDOO NEO' started by Zaki Ahmad Sahari, Jul 4, 2016.

Tags:
  1. Zaki Ahmad Sahari

    Zaki Ahmad Sahari New Member

    Joined:
    Jul 4, 2016
    Messages:
    1
    Likes Received:
    0
    Hi, I'm new to this I just bought an Udoo Neo. I'm trying to use the Wifi by using Arduino I keep getting this error

    C:\Program Files (x86)\Arduino\libraries\WiFi\src/WiFi.h:30:23: fatal error: IPAddress.h: No such file or directory

    #include "IPAddress.h"

    ^

    compilation terminated.

    exit status 1
    Error compiling for board UDOO Neo (Cortex M4).

    Anyone knows why is it so?

    This is my coding. I got it from Arduino Webpage example.

    #include <SPI.h>
    #include <WiFi.h>

    void setup() {
    //Initialize serial and wait for port to open:
    Serial.begin(9600);
    while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
    }

    // check for the presence of the shield:
    if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
    }

    String fv = WiFi.firmwareVersion();
    if (fv != "1.1.0") {
    Serial.println("Please upgrade the firmware");
    }

    // Print WiFi MAC address:
    printMacAddress();
    }

    void loop() {
    // scan for existing networks:
    Serial.println("Scanning available networks...");
    listNetworks();
    delay(10000);
    }

    void printMacAddress() {
    // the MAC address of your Wifi shield
    byte mac[6];

    // print your MAC address:
    WiFi.macAddress(mac);
    Serial.print("MAC: ");
    Serial.print(mac[5], HEX);
    Serial.print(":");
    Serial.print(mac[4], HEX);
    Serial.print(":");
    Serial.print(mac[3], HEX);
    Serial.print(":");
    Serial.print(mac[2], HEX);
    Serial.print(":");
    Serial.print(mac[1], HEX);
    Serial.print(":");
    Serial.println(mac[0], HEX);
    }

    void listNetworks() {
    // scan for nearby networks:
    Serial.println("** Scan Networks **");
    int numSsid = WiFi.scanNetworks();
    if (numSsid == -1) {
    Serial.println("Couldn't get a wifi connection");
    while (true);
    }

    // print the list of networks seen:
    Serial.print("number of available networks:");
    Serial.println(numSsid);

    // print the network number and name for each network found:
    for (int thisNet = 0; thisNet < numSsid; thisNet++) {
    Serial.print(thisNet);
    Serial.print(") ");
    Serial.print(WiFi.SSID(thisNet));
    Serial.print("\tSignal: ");
    Serial.print(WiFi.RSSI(thisNet));
    Serial.print(" dBm");
    Serial.print("\tEncryption: ");
    printEncryptionType(WiFi.encryptionType(thisNet));
    }
    }

    void printEncryptionType(int thisType) {
    // read the encryption type and print out the name:
    switch (thisType) {
    case ENC_TYPE_WEP:
    Serial.println("WEP");
    break;
    case ENC_TYPE_TKIP:
    Serial.println("WPA");
    break;
    case ENC_TYPE_CCMP:
    Serial.println("WPA2");
    break;
    case ENC_TYPE_NONE:
    Serial.println("None");
    break;
    case ENC_TYPE_AUTO:
    Serial.println("Auto");
    break;
    }
    }
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Which WiFi do you want to work with? The WiFi on the Neo or a wifi shield? The code is for a wifi shield. What do you want to do with WiFi?

    The wifi on the Neo ( if you have a Neo with wifi) is not directly accessable from the Arduino part. You have to send/receive the data through the standard serial connection /dev/ttyMCC between Linux and Arduino. From Linux you have to send/receive data from the external device.
    See the Neo as a computer with network possibilities and a separate Arduino.
     
    Andrea Rovai and I Hate Google! like this.

Share This Page