From 7fa789f7fa4eb55232a87d4aeb801cb7e760b08a Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sat, 16 Jan 2021 20:40:16 +0100 Subject: Prototype pour le jeux Commencement d'un prototype pour le fonctionnement du jeux Simon. --- prototype_simon.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 prototype_simon.c (limited to 'prototype_simon.c') diff --git a/prototype_simon.c b/prototype_simon.c new file mode 100644 index 0000000..2b3ed83 --- /dev/null +++ b/prototype_simon.c @@ -0,0 +1,70 @@ +#include +#include +#include +#include + +void fonction_led(char* couleur, int position) { //a modifier avec le reel + printf("(La led %s se met en position %d.)\n", couleur, position); +} + +void affiche_lcd(char* contenu) { //a modifier par l'utlisation des lib + printf ("[LCD : %s]\n", contenu); +} + +char* choix_aleatoire(void) { //fonctionne + char* couleur_leds[3]={"R","V","J"}; //nos led + srand(time(0)); + int aleatoire = (rand() % (2 - 0 + 1)) + 0; //choix entre 0 et 2 + char* choix = couleur_leds[aleatoire]; + return choix; +} + + +int main(void) { + affiche_lcd("Bienvenue sur SIMON_STM32"); + + int etat_bouton_start = 1; //a changer en fonction des pins et tout + int niveau = 0; + char* suite_de_leds[100]; + int perdu = 0; + + + int tour=0; + while (tour<10 && perdu!= 1) { + if (etat_bouton_start){//a changer... + affiche_lcd("Let's go !"); + suite_de_leds[niveau] = choix_aleatoire(); + niveau++; + for (int i = 0; i