Arduino Ethernet Board R3 with WIFI -
i have been playing around arduino 2 days now, new this, have problem: wifi shield wont work arduino ethernet r3. got them sparkfun:
https://www.sparkfun.com/products/11361 https://www.sparkfun.com/products/11287
and every time try run code:
/* example prints wifi shield's mac address, , scans available wifi networks using wifi shield. every ten seconds, scans again. doesn't connect network, no encryption scheme specified. circuit: * wifi shield attached created 13 july 2010 dlf (metodo2 srl) modified 21 junn 2012 tom igoe , jaymes dec */ #include <spi.h> #include <wifi.h> void setup() { //initialize serial , wait port open: serial.begin(9600); while (!serial) { ; // wait serial port connect. needed leonardo } // check presence of shield: unsigned long start=millis(); while (wifi.status() == wl_no_shield) { if ((millis()-start)>30000) { serial.println("wifi shield not present"); // don't continue: while(true); } delay(500); } // print wifi mac address: printmacaddress(); // scan existing networks: serial.println("scanning available networks..."); listnetworks(); } void loop() { delay(10000); // scan existing networks: serial.println("scanning available networks..."); listnetworks(); } void printmacaddress() { // mac address of wifi shield byte mac[6]; // print 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 nearby networks: serial.println("** scan networks **"); int numssid = wifi.scannetworks(); if (numssid == -1) { serial.println("couldn't wifi connection"); while(true); } // print list of networks seen: serial.print("number of available networks:"); serial.println(numssid); // print network number , name each network found: (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 encryption type , print out 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; } }
i wifi shield not present. ideas on how connect it?
thank you!
the products listed seem redundant. specifically, ~/11361 all-in-one arduino dev. board + ethernet no wireless (i.e. ethernet connection via cable), while ~/11287 wifi shield used on generic arduino board , connects internet.
the problem might using 11287 shield on 11361 leads conflicts? don't know, link http://arduino.cc/en/reference/wifi has following comment:
the wifi library similar ethernet library, , many of function calls same.
which makes me little suspect.
try shield (11287) on standard arduino board.
Comments
Post a Comment