Program for test the tcp/ip communication between mbed and Android phone
Dependencies: EthernetInterface mbed-rtos mbed
Notebook page HERE
Diff: main.h
- Revision:
- 0:149b394928f3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.h Wed Jul 20 20:24:15 2016 +0000 @@ -0,0 +1,48 @@ +#pragma once +#include "mbed.h" +#include "EthernetInterface.h" +#include "eth_status.h" + + +#define ECHO_SERVER_PORT 2000 + + +bool new_send = false; +bool checketh = false; + +DigitalOut led1(LED1); // broken cable +DigitalOut led2(LED2); // ARM is alive? +DigitalOut led3(LED3); // 0 = established connection +DigitalOut led4(LED4); // + + +Serial pc(USBTX, USBRX); + + +//ETHERNET +char* ip = "192.168.153.153"; // ip +char* mask = "255.255.255.0"; // mask +char* gateway = "192.168.153.254"; // gateway +EthernetInterface eth; +TCPSocketConnection client; +TCPSocketServer server; + + +//ETHERNET BUFFER +char bufferRX[20]; +char bufferTX[4800]; + +//RESET +extern "C" void mbed_reset(); + + + +//THREAD +void net_thread(void const *argument); +osThreadId tencid; +osThreadDef(net_thread, osPriorityNormal, DEFAULT_STACK_SIZE); + + + +//FUNCTION +void parse_cmd(int sizeCMD);