
kikjk
Dependencies: Motor SoftPWM mbed
Revision 1:3a5d4d01fb73, committed 2015-10-27
- Comitter:
- WAT34
- Date:
- Tue Oct 27 07:27:39 2015 +0000
- Parent:
- 0:4b4f20abc93b
- Commit message:
- yanagi adjusted.;
Changed in this revision
Motor.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 4b4f20abc93b -r 3a5d4d01fb73 Motor.lib --- a/Motor.lib Fri Oct 09 07:19:24 2015 +0000 +++ b/Motor.lib Tue Oct 27 07:27:39 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/simon/code/Motor/#f265e441bcd9 +https://developer.mbed.org/users/WAT34/code/Motor/#826e2cff5b02
diff -r 4b4f20abc93b -r 3a5d4d01fb73 main.cpp --- a/main.cpp Fri Oct 09 07:19:24 2015 +0000 +++ b/main.cpp Tue Oct 27 07:27:39 2015 +0000 @@ -8,39 +8,47 @@ Motor aj(p21,p16,p15); Motor ya(p22,p18,p17); BusIn limits(p5,p8); +DigitalOut nn(p19); +int a; +void rev(){ + ya.speed(-0.40); + a = 0; +} int main() { - int a; + nn = 0; int limit; char na=0,read=0; while(1) { limit = limits; // serial受信 if(nara.readable()) { - na = nara.getc(); + na = ~nara.getc(); + mas.putc(na>>2); } if(mas.readable()) { read = mas.getc(); } + //輪を回転 - if(na==1) { + if(na%2) { + aj.speed(-0.8); + led = 1; + } else if((na>>1)%2) { aj.speed(0.8); - led = 1; - } else if(na == 2) { - aj.speed(-0.8); led =2; }else{ - aj.speed(0); + aj.brake(); led = 0; } //やなぎシステム - if(read==2) { - ya.speed(0.9); + if(read==1) { + ya.speed(0.40); a = 1; } if(limits == 2&& a == 1) { - ya.speed(-0.9); - a = 0; + yana.attach(&rev,1.0); + a = 3; } if(limits==1 && a==0) { ya.speed(0);