Websocket Test Program for W5500 (WIZ550io) FRDM-KL25Z WIZ550io Ethernet Board.
Dependencies: W5500Interface WebSocketClient mbed
Fork of Websocket_Ethernet_W5500 by
Websocket example using Ethernet component of WIZ550io (W5500). FRDM-KL25Z is used.
Diff: main.cpp
- Revision:
- 5:5f427a506928
- Parent:
- 4:8b4aacaab1f1
- Child:
- 6:5bd7bd3e1b83
--- a/main.cpp Wed Jul 09 08:12:50 2014 +0000 +++ b/main.cpp Wed Jul 09 23:44:22 2014 +0000 @@ -4,8 +4,8 @@ #define _DHCP +//#define _USE_WIZ550io DigitalOut myled(LED1); -//DS18B20Sensor sensor(P1_25); int main() { @@ -19,22 +19,28 @@ #elif defined(TARGET_LPC11U68) SPI spi(P0_9, P0_8, P1_29); // mosi, miso, sclk -//WIZnetInterface eth(&spi, P0_2, P1_25); // spi, cs, reset -//SPI spi(p5, p6, p7); // mosi, miso, sclk - EthernetInterfaceW5500 eth(&spi, P0_2, P1_28);//, nRESET(p9); // reset pin is dummy, don't affect any pin of WIZ550io + EthernetInterfaceW5500 eth(&spi, P0_2, P1_28);//scs(P0_2), nRESET(P1_28) spi.format(8,0); // 8bit, mode 0 spi.frequency(7000000); // 7MHz wait(1); // 1 second for stable state #elif defined(TARGET_KL25Z) SPI spi(D11, D12, D13); // mosi, miso, sclk - EthernetInterfaceW5500 eth(&spi, D10, PTA20);//, nRESET(p9); // reset pin is dummy, don't affect any pin of WIZ550io - + EthernetInterfaceW5500 eth(&spi, D10, PTA20);//scs(D10), nRESET(PTA20) #endif - uint8_t mac_addr[6] = {0x00, 0x08, 0xdc, 0x1c, 0xb8, 0x4a}; + +#ifndef _USE_WIZ550io + // as your env. change to real MAC address; + uint8_t mac_addr[6] = {0x00, 0x08, 0xdc, 0x1c, 0xb8, 0x4a}; // for example +#endif #ifdef _DHCP + +#ifdef _USE_WIZ550io + eth.init(); +#else eth.init((uint8_t *)mac_addr); //Use DHCP +#endif eth.connect(); //printf("IP Address is %s\n\r", eth.getIPAddress()); printf("Initialized, MAC: %s\n", eth.getMACAddress()); @@ -43,8 +49,12 @@ #else // as your env. change to real IP address and so on. +#ifdef _USE_WIZ550io //int ret = eth.init("222.98.173.212", "255.255.255.192", "222.98.173.254"); + int ret = eth.init("192.168.77.10", "255.255.255.0", "192.168.77.1"); +#else int ret = eth.init((uint8_t *)mac_addr, "192.168.77.10", "255.255.255.0", "192.168.77.1"); +#endif if (!ret) { printf("Initialized, MAC: %s\n", eth.getMACAddress()); printf("Connected, IP: %s, MASK: %s, GW: %s\n", @@ -65,16 +75,6 @@ ws.connect(); char str[100]; -/* - char sensorBuf[25]; - - uint8_t result; - uint8_t sensor_cnt; - - //Before using this sensor, should called sensor.count() once. - sensor_cnt = sensor.count(); -*/ - for(int i=0; i<0x10; ++i) { sprintf(str, "%d WebSocket for WIZnet W5500 Hello World over Ethernet : No Sensor", i); ws.send(str);