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: mbed
Revision 4:8fc64106ea7e, committed 2016-03-17
- Comitter:
- joankangro
- Date:
- Thu Mar 17 16:59:25 2016 +0000
- Parent:
- 3:027ba4e5e19d
- Child:
- 5:f27f68d0993f
- Commit message:
- the newest
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Mar 17 15:39:44 2016 +0000 +++ b/main.cpp Thu Mar 17 16:59:25 2016 +0000 @@ -203,8 +203,8 @@ { if(front==1 or midbar==1 or back==1){ - ENA=0.25; - ENB=0.25; + ENA=0.28; + ENB=0.28; } if(front==1) { ledfront=1; @@ -230,25 +230,25 @@ ledback=0; } - if(midbar==1 and back==1) { + if((midbar==1 and back==1) or (midbar==1 and front==1)) { //shoot balls - if(ballcount>0){ - ballcount--; - } ENA=0; ENB=0; motors=0.095; - sound(); - wait_ms(550); - solenoid=1; - display(); - wait_ms(45); - solenoid=0; - wait(3); + while(ballcount>0){ + ballcount--; + sound(); + wait_ms(550); + solenoid=1; + display(); + wait_ms(45); + solenoid=0; + wait(1); + } motors=0; ENA=0.35; ENB=0.35; - wait(3); + wait(2); return bar==1; } else if(midbar==0 and back==1) { //test barcode ENA=0; @@ -261,17 +261,17 @@ wait(1); motors=0; wait(3);*/ - if (ballcount<5){ - dispenser=0.5; - wait(1); - dispenser=0; + while(ballcount<5){ + dispenser=0.5; + wait(1); + dispenser=0; } - else if (ballcount==5){ + ENA=0.35; ENB=0.35; - wait(3); + wait(2); return bar==1; - } + } @@ -350,7 +350,7 @@ wait(0.3); indicator=1; wait(0.3); - indicator=0; + indicator=0;// because its a pile of shite //define pwn freq for dispenser dispenser.period(1/2048); @@ -381,9 +381,6 @@ ball_trigger.fall(&count); //sine_interrupt.attach(&create_sine , interrupt_f); - - //true = left ; false = right - bool direction=true; while(1) { @@ -401,38 +398,31 @@ ledright=0; ledleftmost=0; ledrightmost=0; - - if(direction==true){ - ENA=0; - }else{ - ENB=0; - } + } else { if(middle>0.4) { ledmiddle=1; - ENA=0.55; - ENB=0.55; + ENA=0.45; + ENB=0.45; } else { ledmiddle=0; - ENA=0.45; - ENB=0.45; + ENA=0.4; + ENB=0.4; } if(left>0.4) { ledleft=1; - ENA=0.25; - direction=true; + ENA=0.32; } else { ledleft=0; } if(right>0.4) { ledright=1; - ENB=0.25; - direction=false; + ENB=0.3; } else { ledright=0; } @@ -441,8 +431,7 @@ if(leftmost>0.4) { ledleftmost=1; - ENA=0.15; - direction=true; + ENA=0; } else { ledleftmost=0; } @@ -451,8 +440,7 @@ if(rightmost>0.4) { ledrightmost=1; - ENB=0.15; - direction=false; + ENB=0; } else { ledrightmost=0; } @@ -463,7 +451,6 @@ ENB=0.38; ENA=0; wait(2); - direction=true; }