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
Revision 8:c20dc0f4bc92, committed 2014-06-09
- Comitter:
- bhakti08
- Date:
- Mon Jun 09 23:56:27 2014 +0000
- Parent:
- 7:7f0988b083cb
- Commit message:
- LCD Print;
Changed in this revision
C12832_lcd.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7f0988b083cb -r c20dc0f4bc92 C12832_lcd.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Mon Jun 09 23:56:27 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
diff -r 7f0988b083cb -r c20dc0f4bc92 main.cpp --- 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")))