diff options
author | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-01-16 20:40:16 +0100 |
---|---|---|
committer | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-01-16 20:40:16 +0100 |
commit | 7fa789f7fa4eb55232a87d4aeb801cb7e760b08a (patch) | |
tree | 149dc9091fc7624b5893996fbfd91ca0dc35fb0c | |
parent | b8bdf1716dbbf93569ca1110a175b69084fe7282 (diff) |
Prototype pour le jeux
Commencement d'un prototype pour le fonctionnement du jeux Simon.
16 files changed, 109 insertions, 6 deletions
@@ -1 +0,0 @@ -Simon project with STM32 card. diff --git a/README.ms b/README.ms new file mode 100644 index 0000000..d818380 --- /dev/null +++ b/README.ms @@ -0,0 +1,39 @@ +.so /home/mas/.config/groff/macros.ms +.TL +Projet Simon sur STM32 + +.AU +Aimeric ADJUTOR et Anthony BOULANT + +.AB +Projet d'un jeu Simon avec une carte microcontrolleur STM32. + +.SH +Matériel + +.BL +1 Microcontrolleur NUCLEO-L053R8 +.BL +3 Leds : vert, jaune, rouge +.BL +4 boutons poussoir +.BL +1 écran LCD + +.SH +Simon fait maison + +.PP +But du jeu : Refaire les couleurs (leds) dans l'ordre en apuyant sur le bouton poussoir correspondant. +.PP +A cause d'une contrainte de matérielle, nous utilisons, ici, uniquement 3 leds avec 3 boutons poussoir qui leur sont liés. +.PP +L'écran LCD nous permettra d'afficher du texte (comme Game Over) et le score. +.PP +Un quatrième bouton poussoir sera utilisé comme bouton select/start/reset. + +.SH +Outils logiciel + +.PP +Utilisation de STM32CubeMX et de System Workbench for STM32 diff --git a/Simon-project_links.txt b/Simon-project_links.txt deleted file mode 100644 index 4ac4193..0000000 --- a/Simon-project_links.txt +++ /dev/null @@ -1,5 +0,0 @@ -https://www.youtube.com/channel/UCpRUFdRAcc9CAh4Wpya6icA
-https://github.com/urish/stm32f030-simon
-https://github.com/Vincweb/Microcontroleur_Simon
-https://github.com/h20man13/Simon-With-Stm32-gpio-drivers-
-https://github.com/MightyPork/stm32f103-simon-says
\ No newline at end of file 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 <stdlib.h> +#include <stdio.h> +#include <time.h> +#include <unistd.h> + +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<niveau; i++){ + fonction_led(suite_de_leds[i], 1); + fonction_led(suite_de_leds[i], 0); + } + + affiche_lcd("A vous !"); + int j=0; + do { + char bouton[100]; + scanf("%s", bouton); //a remplacer par la reception IRL du bouton + char* bouton_couleur = bouton; //pareil + + if (*bouton_couleur!=*suite_de_leds[j]){ + affiche_lcd("GAME OVER !"); + affiche_lcd("Niveau atteind :"); + + char niveau_char[10]; + sprintf(niveau_char, "%d", niveau); + + affiche_lcd(niveau_char); + perdu = 1; + } else { + affiche_lcd("BRAVO !"); + perdu = 0; + } + j++; + } while (j<niveau && perdu!=1); + //tant qu'on a des leds a faire allume et qu'on a pas perdu + } + tour++; + } + return 0; +} diff --git a/ressources_projet_elec/LCD.png b/ressources_projet_elec/LCD.png Binary files differnew file mode 100644 index 0000000..358692e --- /dev/null +++ b/ressources_projet_elec/LCD.png diff --git a/ressources_projet_elec/Lab3411-EnonceTP.pdf b/ressources_projet_elec/Lab3411-EnonceTP.pdf Binary files differnew file mode 100644 index 0000000..0394176 --- /dev/null +++ b/ressources_projet_elec/Lab3411-EnonceTP.pdf diff --git a/ressources_projet_elec/YJ-162A.pdf b/ressources_projet_elec/YJ-162A.pdf Binary files differnew file mode 100644 index 0000000..e9bc04e --- /dev/null +++ b/ressources_projet_elec/YJ-162A.pdf diff --git a/ressources_projet_elec/complements_programmation_stm32_v1.6.pdf b/ressources_projet_elec/complements_programmation_stm32_v1.6.pdf Binary files differnew file mode 100644 index 0000000..63f6401 --- /dev/null +++ b/ressources_projet_elec/complements_programmation_stm32_v1.6.pdf diff --git a/ressources_projet_elec/docs_STM32.rar b/ressources_projet_elec/docs_STM32.rar Binary files differnew file mode 100644 index 0000000..3cef2bf --- /dev/null +++ b/ressources_projet_elec/docs_STM32.rar diff --git a/ressources_projet_elec/docs_STM32/Cortex-m0+ProgrammingmgManual.pdf b/ressources_projet_elec/docs_STM32/Cortex-m0+ProgrammingmgManual.pdf Binary files differnew file mode 100644 index 0000000..bb8d69a --- /dev/null +++ b/ressources_projet_elec/docs_STM32/Cortex-m0+ProgrammingmgManual.pdf diff --git a/ressources_projet_elec/docs_STM32/HAL_LL_Drivers.zip b/ressources_projet_elec/docs_STM32/HAL_LL_Drivers.zip Binary files differnew file mode 100644 index 0000000..279c9ae --- /dev/null +++ b/ressources_projet_elec/docs_STM32/HAL_LL_Drivers.zip diff --git a/ressources_projet_elec/docs_STM32/Nucleo_UserGuide.pdf b/ressources_projet_elec/docs_STM32/Nucleo_UserGuide.pdf Binary files differnew file mode 100644 index 0000000..b12e478 --- /dev/null +++ b/ressources_projet_elec/docs_STM32/Nucleo_UserGuide.pdf diff --git a/ressources_projet_elec/docs_STM32/Pin_Mapping.pdf b/ressources_projet_elec/docs_STM32/Pin_Mapping.pdf Binary files differnew file mode 100644 index 0000000..804a95f --- /dev/null +++ b/ressources_projet_elec/docs_STM32/Pin_Mapping.pdf diff --git a/ressources_projet_elec/docs_STM32/STM32L053xx_Reference.zip b/ressources_projet_elec/docs_STM32/STM32L053xx_Reference.zip Binary files differnew file mode 100644 index 0000000..6b2d327 --- /dev/null +++ b/ressources_projet_elec/docs_STM32/STM32L053xx_Reference.zip diff --git a/ressources_projet_elec/docs_STM32/STM32L053xx_Reference/STM32L053xx_Reference.pdf b/ressources_projet_elec/docs_STM32/STM32L053xx_Reference/STM32L053xx_Reference.pdf Binary files differnew file mode 100644 index 0000000..662d075 --- /dev/null +++ b/ressources_projet_elec/docs_STM32/STM32L053xx_Reference/STM32L053xx_Reference.pdf diff --git a/ressources_projet_elec/docs_STM32/stm32l053r8.pdf b/ressources_projet_elec/docs_STM32/stm32l053r8.pdf Binary files differnew file mode 100644 index 0000000..7bbb8c6 --- /dev/null +++ b/ressources_projet_elec/docs_STM32/stm32l053r8.pdf |