Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HTTPClient Motordriver WiflyInterface mbed
Revision 0:d1a9db1a5652, committed 2012-10-12
- Comitter:
- angalo3
- Date:
- Fri Oct 12 16:53:58 2012 +0000
- Commit message:
- Final
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPClient.lib Fri Oct 12 16:53:58 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/HTTPClient/#1f743885e7de
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motordriver.lib Fri Oct 12 16:53:58 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/littlexc/code/Motordriver/#3110b9209d3c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WiflyInterface.lib Fri Oct 12 16:53:58 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/WiflyInterface/#fb4494783863
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Oct 12 16:53:58 2012 +0000
@@ -0,0 +1,85 @@
+#include "mbed.h"
+#include "WiflyInterface.h"
+#include "motordriver.h"
+#include "HTTPClient.h"
+Serial pc(USBTX, USBRX);
+WiflyInterface wifly(p9, p10, p25, p26, "mbed", "password", WPA);
+HTTPClient http;
+
+/* wifly object where:
+* - p9 and p10 are for the serial communication
+* - p25 is for the reset pin
+* - p26 is for the connection status
+* - "mbed" is the ssid of the network
+* - "password" is the password
+* - WPA is the security
+*/
+DigitalOut f(LED1);
+DigitalOut b(LED2);
+DigitalOut l(LED3);
+DigitalOut r(LED4);
+Motor A(p22, p6, p5, 1); // pwm, fwd, rev, can brake
+Motor B(p21, p7, p8, 1); // pwm, fwd, rev, can brake
+int main() {
+wifly.init(); // use DHCP
+while (!wifly.connect());
+char buffer[2];
+buffer[1]='\0';
+char a;
+while(1)
+{
+
+ http.get("http://develop.jissjohn.com/netbot/command.txt", buffer,2);
+
+ printf("\n%s\n\r", buffer);
+ a=buffer[0];
+if(a=='1')// Forward direction
+ {f=1;
+ A.speed(0.4);
+ B.speed(0.4);
+ wait(0.02);
+ }
+else if(a=='5')//Reverse Direction
+ {b=1;
+ f=0;
+ l=0;
+ r=0;
+ A.speed(-0.4);
+ B.speed(-0.4);
+ wait(0.02);
+ }
+else if(a=='7')//Turn Left Direction
+ { l=1;
+ f=0;
+ r=0;
+ b=0;
+ A.speed(-0.5);
+ B.speed(0.5);
+ wait(0.02);
+ }
+else if(a=='3')//Turn Right Direction
+ {r=1;
+ f=0;
+ l=0;
+ b=0;
+ A.speed(0.5);
+ B.speed(-0.5);
+ wait(0.02);
+ }
+else
+ {
+
+ A.stop(1);
+ B.stop(1);
+
+ wait(1);
+ A.coast();
+ B.coast();
+
+ }
+
+}
+wifly.disconnect();
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 12 16:53:58 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc \ No newline at end of file