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 project_ShipDot by
Diff: main.cpp
- Revision:
- 26:5b51ee60beec
- Parent:
- 25:4d3c738d842c
- Child:
- 27:4f2640e5bf10
--- a/main.cpp Sun Dec 04 17:06:33 2016 +0000
+++ b/main.cpp Mon Dec 05 04:43:55 2016 +0000
@@ -5,13 +5,14 @@
#include "ColorMbed.h"
// Setting
-int ifUrJirat = 0;
+int ifUrJirat = 1;
// Initail I/O.
AnalogIn VRx(A0);
AnalogIn VRy(A1);
DigitalIn Button(PA_4);
Serial bt(PA_15, PB_7);
+Serial com(D1,D0);
ColorMbed dotmatrix;
Timer t;
@@ -245,10 +246,7 @@
uli++;
}
}else{
- while(uli<150){
- bt.putc('l');
- uli++;
- }
+ bt.putc('l');
printf("sent l\n");
}
printf("\n");
@@ -259,7 +257,6 @@
printf("Wait for enemy ready\n");
while(1){
if(bt.readable()){
- printf("break;");
break;
}
}
@@ -444,7 +441,7 @@
printf("}\n");
}
void check_ready(){
- if(bt.readable()){enemy_ready = 1;}
+ if(bt.readable()){printf("%c\n",bt.getc());enemy_ready = 1;}
}
char posit2char(int posit){
int as = posit+48;
@@ -552,14 +549,14 @@
m = check_joys(Vx,Vy);
n = check_joys_int(Vx,Vy);
if(n == 1){ iVxVy = 0;}
- if(SW == 1){
+ if(SW == 1 and iSW==1){
iSW = 0;
if(bt.readable()){
enemy_platform[select_Position/10][select_Position%10] = char2posit(bt.getc());
break;
}
}
- if(m!=NULL && iVxVy==0){
+ if(m!=NULL and iVxVy==0){
Select_Position(m,1);
printf("select_Position = %d\n",select_Position);
bt.putc(posit2char(select_Position));
