マザー 20151028 PS3
Dependencies: mbed
Fork of Nucleo_PS3_Jikken3 by
Diff: main.cpp
- Revision:
- 14:aaf2ae25e508
- Parent:
- 13:5bccc2d600eb
- Child:
- 15:c941d06092ec
--- a/main.cpp Sun Oct 04 03:53:39 2015 +0000 +++ b/main.cpp Sun Oct 04 07:34:44 2015 +0000 @@ -141,17 +141,17 @@ double deg=32; while(true) { - /*//スイッチが押された時 + //スイッチが押された時 if(((int)DATA[1]&12)==12&&!btFlag){ wait(0.001f); Mechanum.putc(64); btFlag=true; Blue=0.0f;Green=0.8f;Red=0; vector=64; - }*/ + } //方向選択 - if(!btFlag) + else if((int)deg==devideNum) { deg=devidePoint((double)DATA[3],(double)DATA[2],15,360/devideNum); pc.printf("deg%lf\r\n",deg); @@ -253,25 +253,41 @@ if(getPress(presLeft)&&pLeftF){ pLeftF=false; kRed=shotToDenziben(7,1,1,valveAddr); + wait(2.0); + if(!kRed) + kRed=shotToDenziben(7,0,1,valveAddr); } - else if(!getPress(presLeft)) + else if(!getPress(presLeft)){ + kRed=0; pLeftF=true; + } //バルブ開放 if(getPress(presRight)&&pRightF){ pRightF=false; kRed=shotToDenziben(8,1,1,valveAddr); + wait(2.0); + if(!kRed) + kRed=shotToDenziben(8,0,1,valveAddr); } - else if(!getPress(presRight)) + else if(!getPress(presRight)){ + kRed=0; pRightF=true; + } //バルブ開放 if(getBt(btCro)&&btCrF){ btCrF=false; kRed=shotToDenziben(9,1,1,valveAddr); + wait(0.2); + if(!kRed) + kRed=shotToDenziben(9,0,1,valveAddr); } else if(!getBt(btCro)) + { + kRed=0; btCrF=true; + } //レーザーポインタ @@ -321,7 +337,7 @@ do{ if(!debugFlag) break; - pc.printf("val:%d\r\n",val); + //pc.printf("val:%d\r\n",val); //printf("%lf:%d:%d\r\n",deg,(int)DATA[3],(int)DATA[2]); //printf("%d\r\n",(int)DATA[0]); //pc.printf("DATA[1]%d\r\n",(int)(DATA[1]&0x02));