OX V1
Dependencies: mbed
Diff: Latrix.h
- Revision:
- 1:6514e03fe62f
- Parent:
- 0:6182212860fb
- Child:
- 2:84a84429750a
diff -r 6182212860fb -r 6514e03fe62f Latrix.h --- a/Latrix.h Mon Dec 05 15:55:28 2016 +0000 +++ b/Latrix.h Mon Dec 05 16:10:29 2016 +0000 @@ -1,14 +1,16 @@ #include "mbed.h" -Serial duino(PA_11, PA_12); + //Serial pc(USBTX, USBRX); -Timer timer; + Serial duino(PA_11,PA_12); class Latrix { private: - + + Timer timer; + uint8_t state_new; uint8_t state_menu; @@ -20,7 +22,7 @@ int lis[30]; public: - void Latrix() + void Latrix::latrix() //ตรงนี้นะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะะ { for(int i=0;i<30;i++) { @@ -35,11 +37,11 @@ if (this->timer.read() > 1) { - this->duino.putc(lis[23]); + duino.putc(lis[23]); this->timer.reset(); } - if (this->duino.readable()) + if (duino.readable()) { } } @@ -47,12 +49,12 @@ void Latrix::Win(){ //ชนะ if (this->timer.read() > 1) { //pc.printf("Writing!\n\r"); - this->duino.putc(this->lis[0]); - this->duino.putc(this->lis[1]); - this->duino.putc(this->lis[2]); + duino.putc(this->lis[0]); + duino.putc(this->lis[1]); + duino.putc(this->lis[2]); this->timer.reset(); } - if (this->duino.readable()) + if (duino.readable()) { //pc.printf("recieving %c",duino.getc()); } @@ -62,13 +64,13 @@ if (this->timer.read() > 1) { //pc.printf("Writing!\n\r"); - this->duino.putc(this->lis[3]); - this->duino.putc(this->lis[4]); - this->duino.putc(this->lis[5]); - this->duino.putc(this->lis[6]); + duino.putc(this->lis[3]); + duino.putc(this->lis[4]); + duino.putc(this->lis[5]); + duino.putc(this->lis[6]); this->timer.reset(); } - if (this->duino.readable()) + if (duino.readable()) { //pc.printf("recieving %c",duino.getc()); } @@ -79,7 +81,7 @@ void Latrix::CountDown(int i){ //นับเวลา if (this->timer.read() > 1) { //pc.printf("Writing!\n\r"); - this->duino.putc(this->lis[16-i]); + duino.putc(this->lis[16-i]); /*duino.putc(lis[7]); //9 duino.putc(lis[8]); //8 duino.putc(lis[9]); //7 @@ -93,7 +95,7 @@ this->timer.reset(); } - if (this->duino.readable()){ + if (duino.readable()){ //pc.printf("recieving %c",duino.getc()); } @@ -103,10 +105,10 @@ void Correct(){ //เช็คถูก if (this->timer.read() > 1) { //pc.printf("Writing!\n\r"); - this->duino.putc(lis[18]); + duino.putc(lis[18]); this->timer.reset(); } - if (this->duino.readable()){ + if (duino.readable()){ //pc.printf("recieving %c",duino.getc()); } @@ -115,10 +117,10 @@ void Latrix::Error(){ // if (this->timer.read() > 1) { //pc.printf("Writing!\n\r"); - this->duino.putc(this->lis[19]); + duino.putc(this->lis[19]); this->timer.reset(); } - if (this->duino.readable()){ + if (duino.readable()){ //pc.printf("recieving %c",duino.getc()); } @@ -128,12 +130,12 @@ //pc.printf("Writing!\n\r"); - this->duino.putc(this->lis[20]); + duino.putc(this->lis[20]); this->timer.reset(); } - if (this->duino.readable()){ + if (duino.readable()){ //pc.printf("recieving %c",duino.getc()); } @@ -143,12 +145,12 @@ //pc.printf("Writing!\n\r"); - this->duino.putc(this->lis[21]); + duino.putc(this->lis[21]); this->timer.reset(); } - if (this->duino.readable()){ + if (duino.readable()){ //pc.printf("recieving %c",duino.getc()); } } @@ -158,12 +160,12 @@ //pc.printf("Writing!\n\r"); - this->duino.putc(this->lis[22]); + duino.putc(this->lis[22]); this->timer.reset(); } - if (this->duino.readable()){ + if (duino.readable()){ //pc.printf("recieving %c",duino.getc()); }