5071

When the “Boîte à mheu” was published, I put forward the idea of building a “Simon” type game. Some questions from outside led me to look for a solution to assemble a few components around an ATtiny85 and thus create a little “Simon” type game and at the same time, offer a new toy to Paolina!

// EN :
- The principle adopted for the 4 tactile keys is identical to the piano keys (see lab). 
I assembled four analog key style keys for red, green, yellow and blue key detection.
An ATtiny pin (PB3 pin2) to read the four keys and determine the color touched.
- The LEDs are mounted in the charlieplexing style. Three ATtiny pins for color management (via red, green, yellow, blue LEDs) (PB4 pin3, PB0 pin5, PB2 pin7)
- The buzzer is powered via an npn type transistor, controlled by port PB1 (pin6 of the ATtiny)

The assembly is of the “steering wheel” type, see images and schema ATtiny Simon.

At startup, a rapid flashing sequence of LEDs and a sequence of tones is displayed. A timer is started, if no key is touched, we start in normal mode. If during the start delay the red button is touched, the player has validated the buzzer Off mode. Another key, another mode, it's up to you to play with the code. 

Then, it's up to you to repeat the sequence proposed by the game.

If the waiting time exceeds the tempo error, it is lost.
If the key is played, if ok, we move on to the second sequence (two LEDs) otherwise, key error, it is lost.... and so on
To simulate an analog input 'in the air' which should generate a random seed, we use the watchdog configured to trigger (without reset) every 16ms and increment a value from 0 to 1023.Arrived at max value, we reset and start again.

The maximum game threshold is set at 12. Adjustable in the code.
The principle of power supply by 18650 battery and its recharge is identical to the crank box. (see lab)
See making little simon pdf 
Little demo here
https://youtube.com/shorts/Ou07BWl1MkI
Enjoy the game.

// FR:
- Le principe adopté pour les 4 touches tactiles est identique au touches du piano (voir lab). J'ai assemblé quatre touches façon clé analogique pour la détection de touche rouge, verte, jaune et bleue.
Une pin de l'ATtiny (PB3 pin2) pour lire les quatre touches et déterminer la couleur touchée.
- Les leds sont montées dans le style charlieplexing. Trois pins de l'ATtiny pour la gestion des couleurs (via les leds rouge, verte, jaune, bleue)
(PB4 pin3, PB0 pin5, PB2 pin7)
- Le buzzer est alimenté via un transistor type NPN, commandé par le port PB1 (pin6 de l'ATtiny)

Le montage est de type "volant", voir images et schéma.

Au démarrage, on affiche une séquence clignotement rapide de led, une séquence de tonalités. Une temporisation est lancée, si pas de touche touché, on démarre en mode normal. Si durant la temporisation de démarrage la touche rouge est touché, le joueur a validé le mode buzzer Off.
Autre touche, autre mode, à vous de jouer avec le code.
Ensuite, c'est à vous de répéter la séquence proposé par le jeu. Si la durée d'attente dépasse la tempo error, c'est perdu.
Si la touche est joué, si ok, on passe à la deuxième séquence (deux leds) sinon, erreur de touche, c'est perdu.... et ainsi de suite.

Pour simuler une entrée analogique 'en l'air' qui devrait générer une graine aléatoire, on utilise le chien de garde paramétré pour déclencher (sans reset) toutes les 16ms et incrémenter une valeur de 0 à 1023.
Arrivé à valeur max, on reset et on recommence.
Le seuil maximum de parties est fixé à 12. Réglable dans le code.

Voir making little simon pdf
Mini démo..
https://youtube.com/shorts/Ou07BWl1MkI
Bonne partie.
brUNO Clerc
for reader