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:
- 1:8535eef790f1
- Parent:
- 0:738a25907be7
--- a/main.cpp Thu Jun 06 23:50:08 2019 +0000 +++ b/main.cpp Mon Jun 17 08:25:54 2019 +0000 @@ -11,27 +11,51 @@ int main(void){ i2c.frequency(100000); int circle; - int cross; + int old_circle; + //int cross; + int memo = 0; + char ninty = 0x01; + char zero = 0x02; + char nosignal = 0xff; + char add = 0x18; + while(1){ circle = ps3.getButtonState(maru); - cross = ps3.getButtonState(batu); - char ninty = 0x01; - char zero = 0x02; - char nosignal = 0xff; - char add = 0x18; - if(circle == 1){ + if(circle != old_circle){ + old_circle = circle; + if(circle == 1 && memo == 1){ + send(add,ninty); + memo = 0; + }else if(circle == 1 && memo == 0){ + send(add,zero); + memo = 1; + }else{ + send(add,nosignal); + } + }/*else{ + send(add,nosignal); + }*/ + + + //cross = ps3.getButtonState(batu); + + /*pc.printf("%4d:%4d\n",circle,memo_servo); + + if(circle == 1 && memo_servo == 1){ send(add,ninty); - pc.printf("0x01\n"); - }else if(cross == 1){ + memo_servo = 0; + wait(3); + + }else if(circle == 1 && memo_servo == 0){ send(add,zero); - pc.printf("0x02\n"); + memo_servo = 1; + wait(3); }else{ send(add,nosignal); - pc.printf("0xff\n"); - } - } + }*/ + } } void send(char address,char data){