This program is used to control the car remotely via telnet using wifi.
Dependencies: C12832_lcd WiflyInterface mbed
Fork of Mode-3_Remote_Control by
Diff: main.cpp
- Revision:
- 8:c20dc0f4bc92
- Parent:
- 7:7f0988b083cb
--- a/main.cpp Mon Jun 09 23:41:37 2014 +0000 +++ b/main.cpp Mon Jun 09 23:56:27 2014 +0000 @@ -1,6 +1,7 @@ //This Program is used to turn the LED ON/OFF via telent (Wifly connected) #include "mbed.h" #include "WiflyInterface.h" +#include "C12832_lcd.h" #include <string.h> #define ECHO_SERVER_PORT 7 @@ -17,7 +18,8 @@ PwmOut servo(p22); DigitalOut dir(LED1); BusOut motor(p5,p6,p7); - +C12832_LCD lcd; +Serial pc(USBTX,USBRX); //#define FWD 1 //#define REV 0 @@ -41,17 +43,18 @@ wifly.init(); //Use DHCP printf("1\r\n"); while (!wifly.connect()); - printf("IP Address is %s\n\r", wifly.getIPAddress()); + lcd.printf("IP Address is %s\n\r", wifly.getIPAddress()); TCPSocketServer server; server.bind(ECHO_SERVER_PORT); server.listen(); - - printf("\nWait for new connection...\n"); + lcd.cls(); + lcd.printf("\nWait for new connection...\n"); TCPSocketConnection client; server.accept(client); - printf("Server accept\r\n"); + lcd.locate(0,20); + lcd.printf("Server accept\r\n"); char buffer[256]; servo.period_us(50); @@ -61,7 +64,7 @@ int n = client.receive(buffer, sizeof(buffer)); if (n <= 0) continue; buffer[n] = 0; - printf("String is : %s\r\n",buffer); + pc.printf("String is : %s\r\n",buffer); client.send_all(buffer, n); if (!(strcmp (buffer, "w")))