[vc_row][vc_column][vc_column_text]
The DiamondBack is an Arduino Duemilanove compatible clone that has 802.11b wireless connectivity baked directly onto the board. The DiamondBack will give your Arduino projects added wireless connectivity without the need for additional bulky shields![/vc_column_text][vc_tour][vc_tab title=”Part list” tab_id=”1397782589-1-68″][vc_column_text]1 x [bigcommerce link=”/wifi-diamondback-1-0-arduino-compatible-wifi/” target=”_blank”] Diamondback[/bigcommerce]
1 x [bigcommerce link=”/base-shield-of-linker-kit-for-pcduino-arduino/” target=”_blank”]Linker base shield[/bigcommerce]
1 x [bigcommerce link=”/breakout-of-dht11-temperature-and-humidity-sensor/” target=”_blank”]Linker temperature [/bigcommerce]
1 x [bigcommerce link=”/20-cm-cable-for-linker-kit/” target=”_blank”] Linker cable [/bigcommerce][/vc_column_text][/vc_tab][vc_tab title=”Wiring Diagram” tab_id=”1397782589-2-53″][vc_column_text]Linker temperature – > Base shield A0
base shield – >diamondback
Power the diamond with the Mini USB
[/vc_column_text][/vc_tab][vc_tab title=”Test code” tab_id=”1397783648508-2-5″][vc_column_text]Download the wishield library:Wishield
Unzip it and rename it as ZG2100BasedWiFiShield, then put it under the arduinolibraries directory.
Open the Arduino IDE and input the code below
/* * A simple sketch that uses WiServer to serve a web page */ #include #define WIRELESS_MODE_INFRA 1 #define WIRELESS_MODE_ADHOC 2 #define AREF_VOLTAGE 5 const int tmpPin = A0; int tmpReading = 0; // Wireless configuration parameters ---------------------------------------- unsigned char local_ip[] = {192,168,31,199}; // IP address of WiShield unsigned char gateway_ip[] = {192,168,31,1}; // router or gateway IP address unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network const prog_char ssid[] PROGMEM = {"Linksprite-02"}; // max 32 bytes unsigned char security_type = 3; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2 // WPA/WPA2 passphrase const prog_char security_passphrase[] PROGMEM = {"Linksprite123456"}; // max 64 characters // WEP 128-bit keys // sample HEX keys prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3 }; // setup the wireless mode // infrastructure - connect to AP // adhoc - connect to another WiFi device unsigned char wireless_mode = WIRELESS_MODE_INFRA; unsigned char ssid_len; unsigned char security_passphrase_len; // End of wireless configuration parameters ---------------------------------------- float testTmp (void){ tmpReading = analogRead (tmpPin); float voltage = tmpReading * AREF_VOLTAGE; voltage /= 1023; float tmpC = (voltage - 0.5) * 100; return tmpC; } // This is our page serving function that generates web pages boolean sendMyPage(char* URL) { // Check if the requested URL matches "/" if (strcmp(URL, "/") == 0) { // Use WiServer's print and println functions to write out the page content float tmpC = testTmp (); WiServer.print(""); WiServer.print("The current temperature is "); WiServer.print(tmpC); WiServer.print(""); // URL was recognized return true; } // URL not found return false; } void setup() { // Initialize WiServer and have it use the sendMyPage function to serve pages WiServer.init(sendMyPage); // Enable Serial output and ask WiServer to generate log messages (optional) Serial.begin(57600); WiServer.enableVerboseMode(true); } void loop(){ // Run WiServer WiServer.server_task(); delay(10); }
Change the settings, input the right IP address, default gateway and subnet mask according to your wireless router settings.
[/vc_column_text][/vc_tab][vc_tab title=”Test result”][vc_column_text]Input the IP address at the browser address on the computer which has the same Network segment as we set it:192.168.31.199, it showed what SimpleServer is about.(this IP is for demo)[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.