ENIB 2022 : Snake Player : Différence entre versions

De Les Fabriques du Ponant
Aller à : navigation, rechercher
(Code)
m
 
Ligne 1 138 : Ligne 1 138 :
  
 
==sources ==
 
==sources ==
* https://create.arduino.cc/projecthub/khanhhs/arduino-web-based-two-player-game-584daa?ref=platform&ref_id=424_trending__beginner_&offset=7
+
* https://create.arduino.cc/projecthub/rishab8551/arduino-snake-game-using-arduino-and-martix-6c230c
* html dans le wemos D1 mini : https://projetsdiy.fr/littlefs-spiffs-projet-esp8266-pio-platformio-televerser-data/
 
* utiliser le D1 mini avec arduino : https://www.wikidebrouillard.org/wiki/Utiliser_le_D1_mini_avec_Arduino
 
* gestion de plusieurs matrices de led : https://forum.arduino.cc/t/adding-multiple-max7219-dot-matrixes-to-snake-game/629949
 
 
 
===Des Jeux en HTML qui pourraient fonctionner sur lke D1 mini===
 
* https://www.w3schools.com/graphics/game_intro.asp
 
* https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_breakout_game_Phaser/Buttons
 
 
* https://www.instructables.com/8x8-Matrix-Snake-Game/
 
* https://www.instructables.com/8x8-Matrix-Snake-Game/
  

Version actuelle datée du 17 janvier 2022 à 15:03

photo de l'équipe

EnibSnake.png

Que fait ce projet ?

Le snakeGame est un genre de jeu vidéo dans lequel le joueur dirige un serpent qui grandit et constitue ainsi lui-même un obstacle.

Liste des composants

  • Arduino UNO
  • 8x32 Led Matrix
  • Analog Joystick
  • breadboard (generic)
  • Jumpers
  • potentiomètre

Code

// Dahddammm Robotics//

#include <MD_KeySwitch.h>
#include <MD_MAX72xx.h>
#define MAX_DEVICES 5
#define CLK_PIN  13  // or SCK
#define DATA_PIN 11  // or MOSI
#define CS_PIN  10  // or SS
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE,CS_PIN, MAX_DEVICES);

const int potmeter = 3;
int coord[200][2];
int leng = 1;
int prev;
int point[5][2] {{10,5},{3,1},{25,3},{15,7},{11,3}};

int ch1 = 5;
int ch2 = 8;
int ch3 = 9;
int ch4 = 4;
int aa = 6;
int bb = 19;
int cc = 2;
int dd = 1;
int ee = 0;
int ff = 7;
int gg = 3;
int dot = 25;
int delay1=3;

int blue = 12;
int green = 18;

int screens = 1;
int record;
int points;
int screenpick = 0;
int diff = 0;
int speedx;
int supermode;
int doublepoints;
long counter;


void slide()
{
  for(int x = 99; x > 0; x--)
  {
    coord[x][0] = coord[x-1][0];
    coord[x][1] = coord[x-1][1];
  }
  return;
}



int Joystick()
{
  // 0 = up
  // 1 = down
  // 2 = right
  // 3 = left
  // 4 = nothing
  // 5 = click
  const int VRx = 0;
  const int VRy = 1;
  const int SW = 2;
  if(analogRead(VRy) > 900)
  {
    prev = 0;
    return 0;
  }
  if(analogRead(VRy) < 120)
  {
    prev = 1;
    return 1;
  }
  if(analogRead(VRx) > 900)
  {
    prev = 2;
    return 2;
  }
  if(analogRead(VRx) < 120)
  {
    prev = 3;
    return 3;
  }
  if(analogRead(SW) == 0)
  {
    return 5;
  }
  return prev;
}

// Dahddammm Robotics//


void setup() 
{
  mx.begin();
  coord[1][0] = coord[0][0] =  5;
  coord[1][1] = coord[0][1] =  5;
   pinMode(ch1, OUTPUT);
  pinMode(ch2, OUTPUT);
  pinMode(ch3, OUTPUT);
  pinMode(ch4, OUTPUT);
  pinMode(aa, OUTPUT);
  pinMode(bb, OUTPUT);
  pinMode(cc, OUTPUT);
  pinMode(dd, OUTPUT);
  pinMode(ee, OUTPUT);
  pinMode(ff, OUTPUT);
  pinMode(gg, OUTPUT);
  pinMode(dot, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(green, OUTPUT);
}

void led(int x, int y)
{
  mx.setPoint(y-1, x-1, 1);
  return;
}



void loop() 
{
  while(screens == 1)
  {
    supermode = 0;
    doublepoints = 0;
    digitalWrite(blue,0);
    digitalWrite(green,0);
    mx.clear();
    if (points > record)
    {
      record = points;
    }
    coord[1][0] = coord[0][0] =  5;
    coord[1][1] = coord[0][1] =  5;
    while(screens == 1)
    {
      diff = analogRead(potmeter) / 100;
      if (Joystick() == 5)
      {
        screens = 0;
        speedx = (12-diff)*9;
        screenpick = 0;
        leng = 1;
        points = 0;
      }
      if (analogRead(0) > 1000)
      {
        screenpick++;
        if(screenpick > 2) screenpick = 0;
        mx.clear();
        delay(1000);
      }
      if (analogRead(0) < 150)
      {
        screenpick--;
        if(screenpick < 0) screenpick = 2;
        mx.clear();
        delay(1000);
      }
      switch(screenpick)
      {
        case 0: 
        printNumber(points,0);
        // E
        led(30,7);
        led(30,3);
        led(30,4);
        led(30,5);
        led(30,6);
        led(29,3);
        led(28,3);
        led(29,7);
        led(28,7);
        led(28,5);
        led(29,5);

        // N
        led(21,3);
        led(21,4);
        led(21,5);
        led(21,6);
        led(21,7);
        led(22,4);
        led(23,5);
        led(24,6);
        led(25,3);
        led(25,4);
        led(25,5);
        led(25,6);
        led(25,7);

        //I
        led(19,3);
        led(19,4);
        led(19,5);
        led(19,6);
        led(19,7);

        //B
        
        led(14,4);
        
        led(14,6);
       

        led(15,3);
        led(15,5);
        led(15,7);

        led(16,3);
        led(16,5);
        led(16,7);

        led(17,3);
        led(17,4);
        led(17,5);
        led(17,6);
        led(17,7);

        
        // FACE
        led(1,3);
        led(1,4);
        led(1,5);
        led(1,6);

        led(2,2);
        led(2,7);

        led(3,1);
        led(3,4);
        led(3,6);
        led(3,8);

        led(4,1);
        led(4,3);
        led(4,8);

        led(5,1);
        led(5,3);
        led(5,8);

        led(6,1);
        led(6,4);
        led(6,6);
        led(6,8);

        led(7,2);
        led(7,7);

        led(8,3);
        led(8,4);
        led(8,5);
        led(8,6);
        
        break;

        case 1:
        printNumber(record,0);
        // E
        led(30,7);
        led(30,3);
        led(30,4);
        led(30,5);
        led(30,6);
        led(29,3);
        led(28,3);
        led(29,7);
        led(28,7);
        led(28,5);
        led(29,5);

        // N
        led(21,3);
        led(21,4);
        led(21,5);
        led(21,6);
        led(21,7);
        led(22,4);
        led(23,5);
        led(24,6);
        led(25,3);
        led(25,4);
        led(25,5);
        led(25,6);
        led(25,7);

        //I
        led(19,3);
        led(19,4);
        led(19,5);
        led(19,6);
        led(19,7);

        //B
        
        led(14,4);
        
        led(14,6);
       

        led(15,3);
        led(15,5);
        led(15,7);

        led(16,3);
        led(16,5);
        led(16,7);

        led(17,3);
        led(17,4);
        led(17,5);
        led(17,6);
        led(17,7);

        
        // FACE
        led(1,3);
        led(1,4);
        led(1,5);
        led(1,6);

        led(2,2);
        led(2,7);

        led(3,1);
        led(3,4);
        led(3,6);
        led(3,8);

        led(4,1);
        led(4,3);
        led(4,8);

        led(5,1);
        led(5,3);
        led(5,8);

        led(6,1);
        led(6,4);
        led(6,6);
        led(6,8);

        led(7,2);
        led(7,7);

        led(8,3);
        led(8,4);
        led(8,5);
        led(8,6);
        
        break;

        case 2:
        printNumber(diff,0);
        // E
        led(30,7);
        led(30,3);
        led(30,4);
        led(30,5);
        led(30,6);
        led(29,3);
        led(28,3);
        led(29,7);
        led(28,7);
        led(28,5);
        led(29,5);

        // N
        led(21,3);
        led(21,4);
        led(21,5);
        led(21,6);
        led(21,7);
        led(22,4);
        led(23,5);
        led(24,6);
        led(25,3);
        led(25,4);
        led(25,5);
        led(25,6);
        led(25,7);

        //I
        led(19,3);
        led(19,4);
        led(19,5);
        led(19,6);
        led(19,7);

        //B
        
        led(14,4);
        
        led(14,6);
       

        led(15,3);
        led(15,5);
        led(15,7);

        led(16,3);
        led(16,5);
        led(16,7);

        led(17,3);
        led(17,4);
        led(17,5);
        led(17,6);
        led(17,7);

        
        // FACE
        led(1,3);
        led(1,4);
        led(1,5);
        led(1,6);

        led(2,2);
        led(2,7);

        led(3,1);
        led(3,4);
        led(3,6);
        led(3,8);

        led(4,1);
        led(4,3);
        led(4,8);

        led(5,1);
        led(5,3);
        led(5,8);

        led(6,1);
        led(6,4);
        led(6,6);
        led(6,8);

        led(7,2);
        led(7,7);

        led(8,3);
        led(8,4);
        led(8,5);
        led(8,6);
        
        break;
        
      }
    }
    
  }
  for (int x = 0; x < speedx; x++)
  {
    printNumber(points,0);
  }
  slide();
  counter++;
  if(counter == 40)
  {
    supermode = 0;
    doublepoints = 0;
    digitalWrite(blue,0);
    digitalWrite(green,0);
  }
  switch(Joystick())
  {
    case 0:
    coord[0][1] = coord[1][1]+1; //y+1
    break;
    case 1:
    coord[0][1] = coord[1][1]-1; //y-1
    break;
    case 2:
    coord[0][0] = coord[1][0]+1; //x+1
    break;
    case 3:
    coord[0][0] = coord[1][0]-1; //x-1
    break;
  }
  for (int x = 0; x < 5; x++)
  {
     if (coord[0][0] == point[x][0] && coord[0][1] == point[x][1])
    {
      if (random(0,diff+1) == 0)
      {
        supermode = 1;
        counter = 0;
        digitalWrite(blue,1);
      }
      if (random(0,9) == 0)
      {
        doublepoints = 1;
        counter = 0;
        digitalWrite(green,1);
      }
      leng++;
      points += 5;
      if(doublepoints == 1) points += 5;
      if (speedx > (10-diff)*3 + 10)
      {
        speedx--;
      }
      point[x][0] = random(1,32);
      point[x][1] = random(1,8);
    }
 }
  if (supermode == 1)
  {
    if(coord[0][0] == 0)
    {
      coord[0][0] = 32;
    }
    if(coord[0][0] == 33)
    {
      coord[0][0] = 1;
    }
    if(coord[0][1] == 0)
    {
      coord[0][1] = 8;
    }
    if(coord[0][1] == 9)
    {
      coord[0][1] = 1;
    }
  }
  mx.clear();
  for (int x = 0; x < leng; x++)
  {
    led(coord[x][0],coord[x][1]);
  }
  for (int x = 0; x < 5; x++)
  {
    led(point[x][0],point[x][1]);
  }
  if (supermode == 0)
  {
     if (coord[0][0] == 0 || coord[0][0] == 33 || coord[0][1] == 0 || coord[0][1] == 9)
     {
      screens = 1;
     }
  }
  
 
  for(int x = 1; x < leng; x++)
  {
    if (coord[0][0] == coord[x][0] && coord[0][1] == coord[x][1])
    {
      screens = 1;
    }
  }
}

void printNumber(long number,int place)
{
  int num1 = number / 1000;
  int num2 = number / 100 - num1 * 10;
  int num3 = number / 10  - num1 * 100 - num2 * 10;
  int num4 = number       - num1 * 1000- num2 * 100 - num3 * 10;

  //charachter 1
  digitalWrite(aa,0);
  digitalWrite(bb,0);
  digitalWrite(cc,0);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
  digitalWrite(dot,0);
  
  digitalWrite(ch1,0);
  digitalWrite(ch2,1);
  digitalWrite(ch3,1);
  digitalWrite(ch4,1);

  if(place==1)
  {
    digitalWrite(dot,1);
  }

  switch(num1)
  {
    case 0: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,0);
    break;

    case 1:
  digitalWrite(aa,0);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;

     case 2: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,0);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,0);
  digitalWrite(gg,1);
    break;

     case 3: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,1);
    break;

     case 4: 
  digitalWrite(aa,0);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 5: 
  digitalWrite(aa,1);
  digitalWrite(bb,0);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 6: 
  digitalWrite(aa,1);
  digitalWrite(bb,0);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 7: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;

     case 8: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 9: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

    default: 
  digitalWrite(aa,0);
  digitalWrite(bb,0);
  digitalWrite(cc,0);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;
  }

  delay(delay1);

  
  //charachter 2
  digitalWrite(aa,0);
  digitalWrite(bb,0);
  digitalWrite(cc,0);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
  digitalWrite(dot,0);

  digitalWrite(ch1,1);
  digitalWrite(ch2,0);
  digitalWrite(ch3,1);
  digitalWrite(ch4,1);

  if(place==2)
  {
    digitalWrite(dot,1);
  }

  switch(num2)
  {
    case 0: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,0);
    break;

    case 1:
  digitalWrite(aa,0);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;

     case 2: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,0);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,0);
  digitalWrite(gg,1);
    break;

     case 3: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,1);
    break;

     case 4: 
  digitalWrite(aa,0);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 5: 
  digitalWrite(aa,1);
  digitalWrite(bb,0);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 6: 
  digitalWrite(aa,1);
  digitalWrite(bb,0);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 7: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;

     case 8: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 9: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

    default:
  digitalWrite(aa,0);
  digitalWrite(bb,0);
  digitalWrite(cc,0);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;
  }

  delay(delay1);

  
  //charachter 3
  digitalWrite(aa,0);
  digitalWrite(bb,0);
  digitalWrite(cc,0);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
  digitalWrite(dot,0);

  digitalWrite(ch1,1);
  digitalWrite(ch2,1);
  digitalWrite(ch3,0);
  digitalWrite(ch4,1);

  if(place==3)
  {
    digitalWrite(dot,1);
  }

  switch(num3)
  {
    case 0: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,0);
    break;

// Dahddammm Robotics//


    case 1:
  digitalWrite(aa,0);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;

     case 2: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,0);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,0);
  digitalWrite(gg,1);
    break;

     case 3: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,1);
    break;

     case 4: 
  digitalWrite(aa,0);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 5: 
  digitalWrite(aa,1);
  digitalWrite(bb,0);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 6: 
  digitalWrite(aa,1);
  digitalWrite(bb,0);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 7: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;

     case 8: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 9: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

    default:
  digitalWrite(aa,0);
  digitalWrite(bb,0);
  digitalWrite(cc,0);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;
  }



  delay(delay1);

  
  //charachter 4
  digitalWrite(dot,0);
  
  digitalWrite(aa,0);
  digitalWrite(bb,0);
  digitalWrite(cc,0);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
  
  digitalWrite(ch1,1);
  digitalWrite(ch2,1);
  digitalWrite(ch3,1);
  digitalWrite(ch4,0);
  if(place==4)
  {
    digitalWrite(dot,1);
  }

  switch(num4)
  {
    case 0: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,0);
    break;

    case 1:
  digitalWrite(aa,0);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;

     case 2: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,0);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,0);
  digitalWrite(gg,1);
    break;

     case 3: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,1);
    break;

     case 4: 
  digitalWrite(aa,0);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 5: 
  digitalWrite(aa,1);
  digitalWrite(bb,0);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 6: 
  digitalWrite(aa,1);
  digitalWrite(bb,0);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 7: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;

     case 8: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,1);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

     case 9: 
  digitalWrite(aa,1);
  digitalWrite(bb,1);
  digitalWrite(cc,1);
  digitalWrite(dd,1);
  digitalWrite(ee,0);
  digitalWrite(ff,1);
  digitalWrite(gg,1);
    break;

    default:
  digitalWrite(aa,0);
  digitalWrite(bb,0);
  digitalWrite(cc,0);
  digitalWrite(dd,0);
  digitalWrite(ee,0);
  digitalWrite(ff,0);
  digitalWrite(gg,0);
    break;
  }

// Dahddammm Robotics//

  delay(delay1);
}

sources

Catégories

Jeu