산업 제조
산업용 사물 인터넷 | 산업자재 | 장비 유지 보수 및 수리 | 산업 프로그래밍 |
home  MfgRobots >> 산업 제조 >  >> Manufacturing Technology >> 제조공정

터치스크린이 있는 Arduino Due TIC TAC TOE

구성품 및 소모품

Arduino Due
× 1
터치스크린이 있는 2,8 zoll TFT LCD
× 1
점퍼 와이어(일반)
× 1

앱 및 온라인 서비스

Arduino IDE

이 프로젝트 정보

안녕하세요, 저는 nickthegreek82:arduino-touch-tic-tac-toe-game의 프로젝트에 대한 작업을 공유하고 싶습니다.

필요한 항목:

<울>
  • Adafruit 도서관
  • <울>
  • GFX 라이브러리
  • <울>
  • 및 URTouch 라이브러리
  • 배선

    터치 스크린의 배선은 다음과 같습니다.

    <울>
  • 터치 -> Arduino Due
  • <울>
  • T_IRQ -> 22
  • <울>
  • T_DO -> 24
  • <울>
  • T_DIN -> 26
  • <울>
  • T_CS -> 28
  • <울>
  • T_CLK -> 30
  • 디스플레이:

    <울>
  • 디스플레이 -> Arduino Due
  • <울>
  • SDO -> A.25
  • <울>
  • LED -> 3.3V
  • <울>
  • SCK -> A.27
  • <울>
  • SDI -> A.26
  • <울>
  • DC -> 9
  • <울>
  • 재설정 -> 8
  • <울>
  • CS -> 10
  • <울>
  • GND -> GND
  • <울>
  • VCC -> 3.3V
  • 2017년 8월 22일

    KI 및 일부 코드 최적화를 수정했습니다.

    2017년 8월 26일

    일부 코드 최적화.

    2017년 8월 27일

    CPU를 이길 수 있습니까?

    2018년 3월 13일

    AI를 위한 더 나은 방법을 찾았습니다.

    klauscam https://github.com/klauscam/ArduinoTicTacToe

    에 감사드립니다. <섹션 클래스="섹션 컨테이너 섹션 축소 가능" id="코드">

    코드

    <울>
  • 틱택토
  • TicTacToe_new
  • TIC TAC TOEArduino
    컴퓨터와 대결하는 간단한 TIC TAC TOE 게임
     /////////////////////////////////// ///////// // 2.8" 터치 스크린 TIC TAC TOE // // // http://www.educ8s.tv // // // // rom3에 의해 08.2017 수정 // / ///////////////////////////////////////////////#include #include #include #include #include #define TFT_RST 8#define TFT_DC 9#define TFT_CS 10#define TOUCH_ORIENTATION LANDSCAPEAdafruit_ILIt (TFT_CS, TFT_DC, TFT_RST);Adafruit_GFX_Button 버튼[9];URTouch myTouch(30, 28, 26, 24, 22);unsigned short int move =1; unsigned short int 승자 =0; //0 =무승부, 1 =Human, 2 =CPUunsigned short int x,y; // 위치 touchunsigned short int cursor; // 커서 위치 unsigned short int firstMoves[]={0,2,6,8}; // CPU가 시작되면 이 위치를 먼저 사용합니다. nsigned short int board[] ={0,0,0,0,0,0,0,0,0};// 위치 데이터를 보유함 0은 공백이고 1은 사람이고 2는 컴퓨터 플레이어입니다. // 참=당신, 거짓=CPUbool b=1; char start[10] ={"Gamestart"};char you[4] ={"YOU"};char cpu[4] ={"CPU"};char again[7] ={"다시?"}; const unsigned char circle[]PROGMEM={0b0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x ,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 ,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xf8,0x0,0x ,0x0,0x0,0x0,0x0,0x7f,0xff,0x80,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,0xf,0x0x ,0x0,0x0,0x0,0x0,0x0,0x1f,0xff,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,0x7f,0xf0,0x3,0xff,0x80,0x0,0x0,0x0,0x0 ,0x0,0x7f,0xc0,0x0,0x0,0x0,0x1,0xfe,0x0,0x0,0x1f,0xe0,0x0,0x0,0x0,0x3,0xf8,0x0,0x0,0x7,0xf0,0x70x0,0 ,0xf0,0x0,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0,0x0,0x0}; 무효 설정() { myTouch.InitTouch(); myTouch.setPrecision(PREC_HI); tft.begin(); tft.setRotation(3); tft.fillScreen(ILI9341_BLACK); //흰색 프레임 그리기 tft.drawRect(0,0,320,240,ILI9341_WHITE); // "Arduino" 텍스트 인쇄 tft.setCursor(80,30); tft.setTextColor(ILI9341_GREEN); tft.setTextSize(4); tft.print("아두이노"); // "Tic Tac Toe" 텍스트 출력 tft.setCursor(30,100); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(4); tft.print("박하 사탕 발가락"); //빨간색 버튼 생성 // 버튼 생성 // x, y, w, h, 외곽선, 채우기, 텍스트 버튼[0].initButton(&tft, 160,200,200,40,ILI9341_WHITE, ILI9341_RED, ILI9341_WHITE, start, 2); 버튼[0].drawButton();do{ waitonetouch(&x,&y); if (buttons[0].contains(x,y)) b=0;}while(b>0); } 무효 루프() { for(unsigned short int i=0;i<9;i++) { 보드[i]=0; } tft.fillScreen(ILI9341_BLACK); //흰색 프레임 그리기 tft.drawRect(0,0,320,240,ILI9341_WHITE); // "Tic Tac Toe" 텍스트 인쇄 tft.setCursor(30,30); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(4); tft.print("박하 사탕 발가락"); // "YouTube!"를 인쇄합니다. 텍스트 tft.setCursor(30,100); tft.setTextColor(ILI9341_GREEN); tft.setTextSize(4); tft.print("시작하는 사람"); //빨간색 버튼 생성 // 버튼 생성 // x, y, w, h, 외곽선, 채우기, 텍스트 버튼[0].initButton(&tft, 100,200,80,40,ILI9341_WHITE, ILI9341_RED, ILI9341_WHITE, you, 2); 버튼[0].drawButton(); // 버튼 생성 // x, y, w, h, 외곽선, 채우기, 텍스트 버튼[1].initButton(&tft, 200,200,80,40,ILI9341_WHITE, ILI9341_RED, ILI9341_WHITE, cpu, 2); 버튼[1].drawButton(); b=1; do{ waitonetouch(&x,&y); if (버튼[0].contains(x,y)) { b=0; 플레이어 =1; tft.fillScreen(ILI9341_BLACK); //흰색 프레임 그리기 tft.drawRect(0,0,320,240,ILI9341_WHITE); tft.setCursor(30,30); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2); tft.print("좋아요, 시작합니다."); 지연(2000); } if(버튼[1].contains(x,y)) { b=0; 플레이어 =0; tft.fillScreen(ILI9341_BLACK); //흰색 프레임 그리기 tft.drawRect(0,0,320,240,ILI9341_WHITE); tft.setCursor(30,30); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2); tft.print("예, CPU가 시작됩니다."); 지연(2000); } }동안(b>0); b=1; 이동 =1; 승자 =0; 커서 =10; tft.fillScreen(ILI9341_BLACK); //프레임 그리기 tft.drawRect(0,0,320,240,ILI9341_WHITE); //수직선 그리기 tft.fillRect(80,15,5,205,ILI9341_WHITE); tft.fillRect(150,15,5,205,ILI9341_WHITE); //가로선 그리기 tft.fillRect(15,80,205,5,ILI9341_WHITE); tft.fillRect(15,150,205,5,ILI9341_WHITE); tft.drawRect(230,10,80,220,ILI9341_WHITE); { do { if(moves%2==1 &&플레이어==거짓 || 이동%2==0 &&플레이어==true) { cursor+=10; tft.setCursor(240, 커서); tft.setTextSize(1); tft.println("그림을 그립니다"); 아두이노무브(); 체크 승자(); }else { 커서+=10; tft.setCursor(240, 커서); tft.setTextSize(1); tft.println("당신의 움직임"); 플레이어 이동(); 체크 승자(); } 지연(1000); 움직임++; }동안 (승자==0 &&이동<10); 대기 원터치(&x,&y); tft.fillScreen(ILI9341_BLACK); //프레임 그리기 tft.drawRect(0,0,320,240,ILI9341_WHITE); // "게임 오버" 텍스트 인쇄 tft.setCursor(50,30); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(4); tft.print("게임 종료"); if(winner ==0){ // "DRAW!" 출력 텍스트 tft.setCursor(110,100); tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(4); tft.print("DRAW");} if(winner ==1){ //"인간의 승리!" 텍스트 tft.setCursor(40,100); tft.setTextColor(ILI9341_BLUE); tft.setTextSize(4); tft.print("인간 승리");} if(승자 ==2){ // "CPU 승리!" 텍스트 tft.setCursor(60,100); tft.setTextColor(ILI9341_RED); tft.setTextSize(4); tft.print("CPU WINS");} // 버튼 생성 // x, y, w, h, 외곽선, 채우기, 텍스트 버튼[0].initButton(&tft, 160,200,200,40,ILI9341_WHITE, ILI9341_RED, ILI9341_WHITE, 다시 , 2); 버튼[0].drawButton(); do{ waitonetouch(&x,&y); if (buttons[0].contains(x,y)) b=0; }동안(b>0); }} 무효 playerMove(){ waitonetouch(&x,&y); if((x>15 &&x<85) &&(y>15 &&y<85)) //0 { if(보드[0]==0) { 보드[0]=1; 드로X(15,15); } 그렇지 않으면 오류(); } else if((x>85 &&x<155)&&(y>15 &&y<85)) //1 { if(board[1]==0) { 보드[1]=1; drawX(85,15); } 그렇지 않으면 오류(); } if((x>155 &&x<225)&&(y>15 &&y<85)) //2 { if(보드[2]==0) { 보드[2]=1; 드로X(155,15); } 그렇지 않으면 오류(); } if((x>15 &&x<85)&&(y>85 &&y<155)) //3 { if(보드[3]==0) { 보드[3]=1; drawX(15,85); } 그렇지 않으면 오류(); } if((x>85 &&x<155)&&(y>85 &&y<155)) //4 { if(보드[4]==0) { 보드[4]=1; drawX(85,85); } 그렇지 않으면 오류(); } if((x>155 &&x<225)&&(y>85 &&y<155)) //5 { if(보드[5]==0) { 보드[5]=1; drawX(155,85); } 그렇지 않으면 오류(); } if((x>15 &&x<85)&&(y>155 &&y<225)) //6 { if(보드[6]==0) { 보드[6]=1; drawX(15,155); } 그렇지 않으면 오류(); } if((x>85 &&x<155)&&(y>155 &&y<225)) //7 { if(보드[7]==0) { 보드[7]=1; drawX(85,155); } 그렇지 않으면 오류(); } if((x>155 &&x<225)&&(y>155 &&y<225)) //8 { if(보드[8]==0) { 보드[8]=1; drawX(155,155); } 그렇지 않으면 오류(); }}무효 오류(){ 커서+=10; tft.setCursor(240, 커서); tft.setTextSize(1); tft.println("오류"); 지연(1000); 커서+=10; tft.setCursor(240, 커서); tft.println("다시 시도하세요."); playerMove();}unsigned short int checkOpponent(unsigned short int x, unsigned short int y){ if(board[1]==x &&board[2]==x &&board[0]==y){ if( y==0){ 0을 반환합니다. } 그렇지 않으면 1을 반환합니다. } if(보드[3]==x &&보드[6]==x &&보드[0]==y){ if(y==0){ return 0; } 그렇지 않으면 6을 반환합니다. } if(보드[0]==y &&보드[4]==x &&보드[8]==x){ if(y==0){ return 0; } 그렇지 않으면 8을 반환합니다. } if(보드[0]==x &&보드[1]==y &&보드[2]==x){ if(y==0){ return 1; } 그렇지 않으면 0을 반환합니다. } if(보드[4]==x &&보드[7]==x &&보드[1]==y){ if(y==0){ return 1; } 그렇지 않으면 7을 반환합니다. } if(보드[0]==x &&보드[1]==x &&보드[2]==y){ if(y==0){ return 2; } 그렇지 않으면 0을 반환합니다. } if(보드[5]==x &&보드[8]==x &&보드[2]==y){ if(y==0){ return 2; } 그렇지 않으면 8을 반환합니다. } if(보드[4]==x &&보드[6]==x &&보드[2]==y){ if(y==0){ return 2; } 그렇지 않으면 6을 반환합니다. } if(보드[4]==x &&보드[5]==x &&보드[3]==y){ if(y==0){ return 3; } 그렇지 않으면 5를 반환합니다. } if(보드[0]==x &&보드[6]==x &&보드[3]==y){ if(y==0){ return 3; } 그렇지 않으면 6을 반환합니다. } if(보드[3]==x &&보드[4]==y &&보드[5]==x){ if(y==0){ return 4; } 그렇지 않으면 3을 반환합니다. } if(보드[1]==x &&보드[7]==x &&보드[4]==y){ if(y==0){ return 4; } 그렇지 않으면 1을 반환합니다. } if(보드[0]==x &&보드[8]==x &&보드[4]==y){ if(y==0){ return 4; } 그렇지 않으면 0을 반환합니다. } if(보드[2]==x &&보드[6]==x &&보드[4]==y){ if(y==0){ return 4; } 그렇지 않으면 2를 반환합니다. } if(보드[3]==x &&보드[4]==x &&보드[5]==y){ if(y==0){ return 5; } 그렇지 않으면 3을 반환합니다. } if(보드[2]==x &&보드[8]==x &&보드[5]==y){ if(y==0){ return 5; } 그렇지 않으면 2를 반환합니다. } if(보드[7]==x &&보드[8]==x &&보드[6]==y){ if(y==0){ return 6; } 그렇지 않으면 8을 반환합니다. } if(보드[0]==x &&보드[3]==x &&보드[6]==y){ if(y==0){ return 6; } 그렇지 않으면 0을 반환합니다. } if(보드[4]==x &&보드[2]==x &&보드[6]==y){ if(y==0){ return 6; } 그렇지 않으면 2를 반환합니다. } if(보드[1]==x &&보드[4]==x &&보드[7]==y){ if(y==0){ return 7; } 그렇지 않으면 1을 반환합니다. } if(보드[6]==x &&보드[8]==x &&보드[7]==y){ if(y==0){ return 7; } 그렇지 않으면 6을 반환합니다. } if(보드[6]==x &&보드[7]==x &&보드[8]==y){ if(y==0){ return 8; } 그렇지 않으면 6을 반환합니다. } if(보드[5]==x &&보드[2]==x &&보드[8]==y){ if(y==0){ return 8; } 그렇지 않으면 2를 반환합니다. } if(보드[4]==x &&보드[0]==x &&보드[8]==y){ if(y==0){ return 8; } 그렇지 않으면 0을 반환합니다. } else return 100;}void arduinoMove(){ if(moves<2) { do{ unsigned short int randomMove =random(4); unsigned short int c=firstMoves[randomMove]; if(보드[c]==0){ 보드[c]=2; drawCpuMove(firstMoves[randomMove]); 반품; } }동안(이동<2); } if(이동<3) { if(보드[4]==0) { 보드[4]=2; drawCpuMove(4); 반품; } } unsigned short int twoPlayer =checkOpponent(2,0);//CPU 2연속? if(twoPlayer <9) { 보드[twoPlayer]=2; drawCpuMove(투플레이어); 반품; } unsigned short int nextMove =checkOpponent(1,0);//플레이어 2연속? if(nextMove <9) { 보드[nextMove]=2; drawCpuMove(nextMove); 반품; } unsigned short int next =checkOpponent(0,2); if(다음 <9) { 보드[다음]=2; drawCpuMove(다음); 반품; } do { unsigned short int randomMove =random(9); if (보드[randomMove]==0) { 보드[randomMove]=2; drawCpuMove(랜덤이동); 반품; } }while(nextMove ==100);} void drawCircle(unsigned short int x, unsigned short int y){ tft.drawBitmap(x,y,circle,65,65,ILI9341_RED);}void drawX(unsigned short int x , unsigned short int y){ tft.drawBitmap(x,y,x_bitmap,65,65,ILI9341_BLUE);}void drawCpuMove(unsigned short int move){ switch(move) { 케이스 0:drawCircle(15,15); 부서지다; 사례 1:drawCircle(85,15); 부서지다; 사례 2:drawCircle(155,15); 부서지다; 사례 3:drawCircle(15,85); 부서지다; 사례 4:drawCircle(85,85); 부서지다; 사례 5:drawCircle(155,85); 부서지다; 사례 6:drawCircle(15,155); 부서지다; 사례 7:drawCircle(85,155);중단; 사례 8:drawCircle(155,155);중단; }}void checkWinner() // 승자가 있는지 확인하기 위해 보드를 확인합니다. // 결과를 전역 변수 'winner'에 배치합니다.{ // 승자가 없습니까? if (보드[0]>0 &&보드[1]==보드[0] &&보드[2]==보드[0]) { 승자=보드[0]; tft.fillRect(15, 45, 205, 5, ILI9341_WHITE); } if (보드[3]>0 &&보드[4]==보드[3] &&보드[5]==보드[3]) { 승자=보드[3]; tft.fillRect(15, 115, 205, 5, ILI9341_WHITE); } if (보드[6]>0 &&보드[7]==보드[6] &&보드[8]==보드[6]) { 승자=보드[6]; tft.fillRect(15, 185, 205, 5, ILI9341_WHITE); } if (보드[0]>0 &&보드[3]==보드[0] &&보드[6]==보드[0]) { 승자=보드[0]; tft.fillRect(45, 15, 5, 205, ILI9341_WHITE); } if (보드[1]>0 &&보드[4]==보드[1] &&보드[7]==보드[1]) { 승자=보드[1]; tft.fillRect(115, 15, 5, 205, ILI9341_WHITE); } if (보드[2]>0 &&보드[5]==보드[2] &&보드[8]==보드[2]) { 승자=보드[2]; tft.fillRect(185, 15, 5, 205, ILI9341_WHITE); } if (보드[0]>0 &&보드[4]==보드[0] &&보드[8]==보드[0]) { 승자=보드[0]; for(unsigned short int xx=0;xx<6;xx++){ tft.drawLine(20+xx, 20, 210+xx, 210, ILI9341_WHITE); } } if (보드[2]>0 &&보드[4]==보드[2] &&보드[6]==보드[2]) { 승자=보드[2]; for(unsigned short int xx=0;xx<6;xx++){ tft.drawLine(210+xx, 20, 20+xx, 210, ILI9341_WHITE); } }} void waitonetouch(unsigned short int *x,unsigned short int *y){ do { delay(10); if (myTouch.dataAvailable() ==true) { myTouch.read(); *x =myTouch.getX(); //터치 포인트 얻기 *y =myTouch.getY(); 반품; } }while(myTouch.dataAvailable()==거짓); }
    TicTacToe_new아두이노
    Arduino Due
     /////////////////////////////////////////////////////////////////////////////////////////////// //////// // 2.8" 터치 스크린 TIC TAC TOE // // // // http://www.educ8s.tv // // // // 2017년 8월 3일에 의해 수정됨 // // /////////////////////////////////////////////#포함  #include #include #include #define TFT_RST 8#define TFT_DC 9#define TFT_CS 10#define TOUCH_ORIENTATION_Adaton LANDSCAPEAdafruit_ILI9341 tft9FX_341;_DCTFT9FX_CS41;_IDC 버튼 [9];URTouch myTouch(30, 28, 26, 24, 22);char start[10] ={"Gamestart"};char you[4] ={"당신"};char cpu[4] ={" CPU"};char again[7] ={"Again?"};int player;int stability=8;unsigned short int x,y,b; // 위치 터치#define BLACK 0x0000#define BLUE 0x001F#define RED 0xF800 #define GREEN 0x07E0#define CYAN 0x07FF#define MAGE NTA 0xF81F#define YELLOW 0xFFE0#define WHITE 0xFFFFint board[]={0,0,0,0,0,0,0,0,0}; // 위치 데이터를 보유함 0은 공백, 1은 사람, 2는 컴퓨터 부호 없는 회전;const unsigned char circle[]PROGMEM={0b0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xf8,0x0 0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0x80,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,0xf,0 0xfc,0x0,0x0,0x0,0x0,0x0,0x1f,0xff,0xff,0xfe,0x0,0x0,0x0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x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; 무효 설정( ){myTouch.InitTouch(); myTouch.setPrecision(PREC_HI); tft.begin(); tft.setRotation(3);} 무효 루프(){ int 보드[9] ={0,0,0,0,0,0,0,0,0}; 그리기 시작 화면(); do{ myTouch.read(); x =myTouch.getX(); //터치 포인트 얻기 y =myTouch.getY(); 지연(100); }while(!(버튼[0].contains(x,y))); tft.fillScreen(검정); //흰색 프레임 그리기 tft.drawRect(0,0,320,240,WHITE); // "Tic Tac Toe" 텍스트 인쇄 tft.setCursor(30,30); tft.setTextColor(흰색); tft.setTextSize(4); tft.print("박하 사탕 발가락"); // "YouTube!"를 인쇄합니다. 텍스트 tft.setCursor(30,100); tft.setTextColor(녹색); tft.setTextSize(4); tft.print("시작하는 사람"); //빨간색 버튼 생성 // 버튼 생성 // x, y, w, h, 외곽선, 채우기, 텍스트 버튼[0].initButton(&tft, 100,200,80,40,WHITE, RED, WHITE, you, 2); 버튼[0].drawButton(); // 버튼 생성 // x, y, w, h, 외곽선, 채우기, 텍스트 버튼[1].initButton(&tft, 200,200,80,40,WHITE, RED, WHITE, cpu, 2); 버튼[1].drawButton(); b=1; do{ myTouch.read(); x =myTouch.getX(); //터치 포인트 얻기 y =myTouch.getY(); if (버튼[0].contains(x,y)) { b=0; 플레이어 =1; tft.fillScreen(검정); //흰색 프레임 그리기 tft.drawRect(0,0,320,240,WHITE); tft.setCursor(30,30); tft.setTextColor(흰색); tft.setTextSize(2); tft.print("좋아요, 시작합니다."); 지연(2000); } if(버튼[1].contains(x,y)) { b=0; 플레이어 =2; tft.fillScreen(검정); //흰색 프레임 그리기 tft.drawRect(0,0,320,240,WHITE); tft.setCursor(30,30); tft.setTextColor(흰색); tft.setTextSize(2); tft.print("예, CPU가 시작됩니다."); 지연(2000); } }동안(b); tft.fillScreen(검정); tft.drawRect(0,0,319,240,흰색); drawVerticalLine(125); drawVerticalLine(195); drawHorizontalLine(80); drawHorizontalLine(150); for(턴 =0; 턴 <9 &&win(board) ==0; ++turn) { if((턴+플레이어) % 2 ==0) computerMove(보드); else { //그리기(보드); 플레이어 이동(보드); } } switch(win(board)) { 사례 0:Serial.println("무승부입니다.\n"); 부서지다; 사례 1://그리기(보드); Serial.println("당신은 졌습니다.\n"); 부서지다; case -1:Serial.println("당신이 이겼습니다!\n"); 부서지다; } do{}while(myTouch.dataAvailable()==false); //x =지도(tp.y, 930, 88, 0, 480); //y =지도(tp.x, 908, 125, 0, 320); //delay(250);} }무효 drawHorizontalLine(int y){ int i=0; for(i=0;i<7;i++) { tft.drawLine(60,y+i,270,y+i,WHITE); }}무효 drawVerticalLine(int x){ int i=0; for(i=0;i<7;i++) { tft.drawLine(x+i,20,x+i,220,WHITE); }}무효 drawStartScreen(){ tft.fillScreen(검정); //흰색 프레임 그리기 tft.drawRect(0,0,319,240,WHITE); // "Tic Tac Toe" 텍스트 출력 tft.setCursor(30,100); tft.setTextColor(흰색); tft.setTextSize(4); tft.print("박하 사탕 발가락"); // "YouTube!"를 인쇄합니다. 텍스트 tft.setCursor(80,30); tft.setTextColor(녹색); tft.setTextSize(4); tft.print("아두이노"); 버튼[0].initButton(&tft, 160,200,200,40,WHITE, RED, WHITE, 시작, 2); 버튼[0].drawButton(); }무효 drawCircle(int x, int y){ drawBitmap(x,y,circle,65,65,RED);}무효 drawX(int x, int y){ drawBitmap(x,y,x_bitmap,65,65,BLUE );}무효 drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) { int16_t i, j, byteWidth =(w + 7) / 8; uint8_t 바이트; for(j=0; j 점수) { 점수 =tempScore; 이동 =나; } } } //주어진 노드에서 미니맥스 트리를 기반으로 점수를 반환합니다. 보드[이동] =1; drawCpuMove(이동); delay(100);} 무효 playerMove(int board[9]) { int move =0; b =1; do{ if (myTouch.dataAvailable() ==true) { myTouch.read(); x =myTouch.getX(); //터치 포인트 얻기 y =myTouch.getY(); if((x>55 &&x<125)&&(y>0 &&y<80)) //0 { if(보드[0]==0) { 이동=0; b=0; } } else if((x>125 &&x<195) &&(y>0 &&y<80)) //1 { if(board[1]==0) { move=1; b=0; } } else if((x>195&&x<265)&&(y>0 &&y<80)) //2 { if(board[2]==0) { move=2; b=0; } } else if((x>55 &&x<125)&&(y>80 &&y<155)) //3 { if(board[3]==0) { move=3; b=0; } } else if((x>125 &&x<195)&&(y>80 &&y<155)) //4 { if(board[4]==0) { move=4; b=0; } } else if((x>195&&x<265)&&(y>80 &&y<155)) //5 { if(board[5]==0) { move=5; b=0; } } else if((x>55 &&x<125)&&(y>155 &&y<235)) //6 { if(board[6]==0) { move=6; b=0; } } else if((x>125 &&x<195)&&(y>155 &&y<235)) //7 { if(board[7]==0) { move=7; b=0; } } else if((x>195&&x<265)&&(y>155 &&y<235)) //8 { if(board[8]==0) { move=8; b=0; } } } }동안(b); 보드[이동] =-1; drawPlayerMove(이동); delay(100);}int win(const int board[9]) { //가능한 우승 위치 목록 unsigned wins[8][3] ={{0,1,2},{3,4,5}, {6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}}; 정수 winPos; for(winPos =0; winPos <8; ++winPos) { if(board[wins[winPos][0]] !=0 &&board[wins[winPos][0]] ==보드[wins[winPos][ 1]] &&보드[wins[winPos][0]] ==보드[wins[winPos][2]]) 보드 반환[wins[winPos][2]]; } return 0;}int minimax(int board[9], int player, int depth) { //check the positions for players int winner =win(board); if(winner !=0) return winner*player; int move =-1; int score =-2; 정수 나; for(i =0; i <9; ++i) { if(board[i] ==0) { board[i] =player; int thisScore=0; if (depth score) { score =thisScore; move =i; } //choose the worst move for opponent board[i] =0; } } if(move ==-1) return 0; return score;}void drawCpuMove(int move){ switch(move) { case 0:drawCircle(55,15); 부서지다; case 1:drawCircle(130,15); 부서지다; case 2:drawCircle(205,15); 부서지다; case 3:drawCircle(55,85); 부서지다; case 4:drawCircle(130,85); 부서지다; case 5:drawCircle(205,85); 부서지다; case 6:drawCircle(55,155); 부서지다; case 7:drawCircle(130,155);break; case 8:drawCircle(205,155);break; }}void drawPlayerMove(int move){ switch(move) { case 0:drawX(55,15); 부서지다; case 1:drawX(130,15); 부서지다; case 2:drawX(205,15); 부서지다; case 3:drawX(55,85); 부서지다; case 4:drawX(130,85); 부서지다; case 5:drawX(205,85); 부서지다; case 6:drawX(55,155); 부서지다; case 7:drawX(130,155);break; case 8:drawX(205,155);break; }}

    회로도

    배선

    제조공정

    1. 박하 사탕 발가락 게임 방문 카드
    2. K30 센서로 CO2 모니터링
    3. 1Sheeld/Arduino를 사용한 청각 장애인용 통신
    4. Arduino로 코인 억셉터 제어
    5. Bluetooth가 탑재된 Arduino로 LED 제어!
    6. Arduino 또는 ESP8266이 있는 정전 용량 지문 센서
    7. Nextion 디스플레이로 재생
    8. Nunchuk 제어 로봇 팔(Arduino 포함)
    9. Arduino로 태양 복사열 측정
    10. Arduino가 있는 미니 레이더