This is first release for WebSocket Client example using WizFi250
Dependencies: WebSocketClient WizFi250Interface mbed
main.cpp
00001 /* 00002 * Copyright (C) 2014 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 "mbed.h" 00021 #include "WizFi250Interface.h" 00022 #include "Websocket.h" 00023 00024 #define SECURE WizFi250::SEC_AUTO 00025 #define SSID "YOUR-SSID" 00026 #define PASS "YOUR-PASSWORD" 00027 00028 #if defined(TARGET_LPC1768) 00029 #define _TXD p28 00030 #define _RXD p27 00031 #define _RTS NC 00032 #define _CTS NC 00033 #define _RESET p21 00034 #define _BAUD 115200 00035 #elif defined(TARGET_KL25Z) 00036 #define _TXD PTE0 00037 #define _RXD PTE1 00038 #define _RTS NC 00039 #define _CTS NC 00040 #define _RESET PTD4 00041 #define _BAUD 115200 00042 #endif 00043 00044 Serial pc(USBTX,USBRX); 00045 WizFi250Interface wizfi250(_TXD,_RXD,_RTS,_CTS,_RESET,NC,_BAUD,&pc); 00046 00047 int main() 00048 { 00049 printf("Start Application\r\n"); 00050 00051 wizfi250.init(); 00052 while (wizfi250.connect(SECURE, SSID, PASS)); 00053 printf("IP Address is %s\r\n", wizfi250.getIPAddress()); 00054 00055 Websocket ws("ws://sockets.mbed.org:443/ws/kaizen/wo"); 00056 while (!ws.connect()); 00057 00058 while(1) 00059 { 00060 printf("Send:Websocket Hello World over WizFi250\r\n"); 00061 ws.send("Websocket Hello World over WizFi250"); 00062 wait(1.0); 00063 } 00064 }
Generated on Sun Jul 17 2022 12:23:15 by 1.7.2