ENIB 2022 - groupe A : Memory Game

De Les Fabriques du Ponant
Révision datée du 13 janvier 2022 à 17:03 par Titouan (discussion | contributions) (Liste des composants)
Aller à : navigation, rechercher

photo de l'équipe

Photoenib2018.jpg

Que fait ce projet ?

Ce projet est un Simon avec 4 leds et 4 boutons poussoirs.

Prototype.png

Liste des composants

  • 4 leds de différentes couleurs
  • 4 boutons poussoirs
  • 1 carte arduino uno
  • 1 carte labdec
  • 1 haut parleur piezo
  • des câbles

const int speaker = D1; // Set to the pin you connected the speaker to

//*****************************************

int LENGTH = 400; // Length of time to play the main notes

int notes[4] = {100, 350, 600, 850}; // Values for the 4 notes used in the game

int gamepattern[20]; // Array to store game pattern in during play

int difficulty = 1;

//*****************************************


void setup() {

 pinMode(D2, OUTPUT); // Set up LED PINS
 pinMode(D3, OUTPUT);
 pinMode(D4, OUTPUT);
 pinMode(D1, OUTPUT);
 pinMode(D6, INPUT); // Set up button pins
 pinMode(D7, INPUT);
 pinMode(D5, INPUT);
 pinMode(D0, INPUT);
 
 Serial.begin(9600); // Enable serial output so we can debug using the serial reader in the Arduino IDE

 }
 

void loop(){ digitalRead(D6); digitalRead(D7);

if (digitalRead(D6) == LOW)

   {
     digitalWrite (D2,HIGH);
   }
   else{      
     digitalWrite (D2,LOW);
     }
     

if (digitalRead(D7) == LOW)

   {
     digitalWrite (D3,HIGH);
   }
   else{      
     digitalWrite (D3,LOW);
     }

if (digitalRead(D5) == LOW)

   {
     digitalWrite (D4,HIGH);
   }
   else{      
     digitalWrite (D4,LOW);
     }
     if (digitalRead(D0) == LOW)
   {
     digitalWrite (D1,HIGH);
   }
   else{      
     digitalWrite (D1,LOW);
     }

}

Catégories