
This is the program of ThingSpeak using WizFi310
Dependencies: WizFi310Interface_Legacy_newv34 mbed
Fork of WizFi310_Tweet_1 by
main.cpp
00001 /* 00002 * Copyright (C) 2015 Wiznet, MIT License 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00005 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00006 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00007 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in all copies or 00011 * substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00014 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00015 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00016 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00017 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00018 */ 00019 00020 #include <stdio.h> 00021 #include "mbed.h" 00022 #include "WizFi310Interface.h" 00023 00024 #define SECURE WizFi310::SEC_WPA2_MIXED 00025 //#define SSID "CDI" 00026 //#define PASS "Cdi*1717" 00027 #define SSID "cdi1" 00028 #define PASS "cdilab17" 00029 # define var i ; 00030 00031 00032 //DigitalOut myled(LED2); 00033 //DigitalIn PIR(D9); 00034 int i = 0; 00035 AnalogIn CDS(A0); 00036 00037 #if defined(TARGET_WIZwiki_W7500) 00038 WizFi310Interface wizfi310(D1, D0, D7, D6, D8, NC, 115200); 00039 Serial pc(USBTX, USBRX); 00040 #endif 00041 00042 int main() 00043 { 00044 pc.baud(115200); 00045 wait(0.5f); 00046 int CDS_data=0; 00047 printf("WizFi310 STATION. \r\n"); 00048 wizfi310.init(); 00049 printf("After Initialisation. \r\n"); 00050 00051 printf("After Set Address. \r\n"); 00052 if ( wizfi310.connect(SECURE, SSID, PASS, WizFi310::WM_STATION)) return -1; 00053 printf("After Connect. \r\n"); 00054 printf("IP Address is %s\r\n", wizfi310.getIPAddress()); 00055 00056 while(1) 00057 { 00058 00059 CDS_data=CDS.read()*1000; 00060 pc.printf("sensor data=%d\r\n ",CDS_data); 00061 00062 00063 wizfi310.test_ThingSpeak(CDS_data); 00064 wait(17); 00065 //wizfi310.disconnect(); 00066 //pc.printf("Hello WizWIki-W7500!\n\r"); 00067 00068 00069 // pc.printf("Reading PIR sensor values!\n\r"); 00070 // pc.printf("===========================================\n\r"); 00071 // int PIR_sensor; 00072 00073 //while (i < 20) { 00074 // PIR_sensor = PIR; 00075 00076 //pc.printf("PIR Value : %d\r\n",PIR_sensor); 00077 00078 // myled =! PIR_sensor; 00079 // wait(0.2f); 00080 // i++; 00081 // } 00082 00083 } 00084 00085 }
Generated on Mon Aug 1 2022 14:23:07 by
