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.
Diff: main.cpp
- Revision:
- 2:5c47df2771ec
- Parent:
- 1:b77a3bd2e93e
- Child:
- 3:43e85adf8768
--- a/main.cpp Sat Jan 10 04:18:22 2015 +0000 +++ b/main.cpp Sat Jan 10 05:30:58 2015 +0000 @@ -1,12 +1,9 @@ #include "mbed.h" -Timer t; Serial pc(USBTX,USBRX); Serial trans(p9,p10); DigitalOut myled(LED1); DigitalOut led2(LED2); -DigitalOut trig(p19); -DigitalIn echo(p20); BusOut mc(p23,p24,p25,p26); PwmOut m1(p21); PwmOut m2(p22); @@ -19,9 +16,8 @@ int l = 6; int r = 9; int stop = 0; - double mp1,mp2,mp1b; + double mp1,mp2; mp1 = (c-1)/100.0; - mp1b = (1-c)/100.0; mp2 = 1.0-((d-1)/100.0); //pc.printf("mp1*mp2--->%f\n\r",mp1*mp2); //pc.printf("mp1--->%f",mp1); @@ -89,24 +85,8 @@ updown = 0; } } -double sonic(double so) -{ - t.reset(); - trig = 1; - wait_us(10); - trig = 0; - if(echo == 1){ - t.start(); - } - if(echo == 0){ - t.stop(); - so = t.read(); - so = (so/2.0)*34000.0; - } - return so; -} + int main() { - double dis = 0; int8_t nx,ny,x,y,down_val,up_val; while(1) { if (trans.getc()== 255){ @@ -119,5 +99,6 @@ move(nx,ny,x,y); up_down(up_val,down_val); } + } }