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
Fork of PS3_BlueUSB_user_ver_circlewar by
Diff: User.cpp
- Revision:
- 17:ae30e74e9eba
- Parent:
- 16:90fb0ef425ac
- Child:
- 18:299810a6dcb4
diff -r 90fb0ef425ac -r ae30e74e9eba User.cpp --- a/User.cpp Thu Mar 10 02:26:38 2016 +0000 +++ b/User.cpp Thu Mar 10 03:23:21 2016 +0000 @@ -12,16 +12,17 @@ //#define DEBUG_MODE #define ID 0 -#define duty1 0. -#define duty2 - +#define duty1 0.1 +#define duty2 0.1 +int servoflag = 0; int RSX,RSY,LSX,LSY,BSU,BSL; //これより下に関数外に書く要素を記入する -DigitalOut LA(p21); -DigitalOut RA(p23); -DigitalOut LH(p22); -DigitalOut RH(p24); -DigitalOut CH(p25); +DigitalOut LA(p18); +DigitalOut RA(p19); +DigitalOut LH(p20); +DigitalOut RH(p21); +DigitalOut CH(p22); +PwmOut motor[2] = {p25,p26}; SPI m(p5, p6, p7); DigitalOut cs(p8); //Serial pc(USBTX,USBRX); @@ -64,15 +65,37 @@ } //ここより下にプログラムを書く //データ取得例 - set_degree(ID,200); int M=0; m.format(16,3); m.frequency(1000000); cs=0; - if((ButtonState >> BUTTONCIRCLE)&1) { +/* if((ButtonState >> BUTTONCIRCLE)&1) { //○が押されたとき } + */ + if((ButtonState >> BUTTONUP)&1){ + motor[0]=0; + motor[1]=0.1; + } + else if((ButtonState >> BUTTONDOWN)&1){ + motor[1]=0; + motor[0]=0.1; + } + else{ + motor[0]=0; + motor[1]=0; + } +/* if((ButtonState >> BUTTONRIGHT)&1){ + set_degree(ID,50); + }else if((ButtonState >> BUTTONLEFT)&1){ + set_degree(ID,200); + }else{*/ + if(servoflag == 0){ + set_degree(ID,135); + servoflag= 1; + } +// } if((ButtonState >> BUTTONL2)&1){ LA=!LA; }