Phares d’iroise

Marc et Jean-Yves ont réaliser des modélisations de phares :
Le four, le Stiff, le Créach, la Jument et Kermorvan sont réalisés.
Ces modélisations 3D doivent clignoter selon leur signature lumineuse,
par ex le Four possède 5 éclats toutes les 15s.

Ainsi, conformément à notre devise, CONCEVOIR – MODÉLISER – FABRIQUER
voici les différentes étapes de ce projet en images :

Vue du fichier stl du phare du Four réalisé avec un logiciel de conception 3D avant son export Gcode
pour l’impression 3D
Programmation de l’Attiny 85 à l’aide de la carte Arduino Uno en mode ISP
//Programme clignotements led en fonction de la valeur analogique
//d'un pont diviseur. © Fablab Iroise

#include "tinysnore.h" // Include TinySnore Library

#define pinLed 0
#define RPin A1

int RValue = 0;

void setup() {
  // put your setup code here, to run once:

  pinMode(pinLed, OUTPUT);
  RValue = analogRead(RPin);


}
void loop() {

  if (RValue < 100) { // Four 5 eclats /15s

    digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(1000);//delay(2000);
        digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(1000);//delay(2000);
        digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(1000);//delay(2000);
        digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(1000);//delay(2000);
        digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(10000);//delay(2000);
  }
  if (RValue > 100 && RValue < 200) { // St-Mathieu 1 eclats /15s
         digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(14500);//delay(2000);
  }
   if (RValue > 200 && RValue < 300) { // Ile Vierge/Kermorvan 1 eclats /5s Pierres noire idem Rouge
         digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(4500);//delay(2000);
  }
   if (RValue > 300 && RValue < 400) { // Le Créach 2 eclats /10s Pierres noire idem Rouge
          digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(1000);//delay(2000);
         digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(8500);//delay(2000);
  }
  if (RValue > 500 && RValue < 600) { // Le Stiff 2 eclats /20s  Rouge
          digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(1000);//delay(2000);
         digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(18500);//delay(2000);
  }
   if (RValue > 700 && RValue < 800) { // Nividic 9 scintillements /10s  Blanc
          digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(250);//delay(2000);
           digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(250);//delay(2000);
           digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(250);//delay(2000);
           digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(250);//delay(2000);
           digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(250);//delay(2000);
           digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(250);//delay(2000);
           digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(250);//delay(2000);
           digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(250);//delay(2000);
         digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(5000);//delay(2000);
  }
  if (RValue > 800 && RValue < 900) { // La Jument 3 eclats /15s  Blanc
          digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(1000);//delay(2000);
    digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(1000);//delay(2000);
         digitalWrite(pinLed, HIGH);   // turn the LED on (HIGH is the voltage level)
    snore(250);                       // wait for a half second
    digitalWrite(pinLed, LOW);    // turn the LED off by making the voltage LOW
    snore(12
    500);//delay(2000);
  }
}
Test du montage sur breadboard : alimentation 3V led + résistance 10Ω, 2 résistances 100 kΩ et 10 kΩ pour le pont diviseur.
Utilisation de la bibliothèque tinysnore pour n’activer la consommation que lors des flashs lumineux
Recherche des valeurs de ponts diviseurs avec les valeurs de résistance disponibles
Conception sur Kicad du circuit
Vue du circuit
Réception des circuits imprimés fabriqués
Montage des composants soudés, la pile est au verso et restera accessible sous le phare

Vœux Fablab Iroise

Cette année 2020 s’achève, en espérant que son lot de contraintes, de confinements et autres complications disparaissent avec elle.

Place aux vœux : en premier de la santé pour tous, puis de la créativité et de la curiosité pour une année riche en découverte.

Enfin pour notre association, j’espère que l’on pourra se rassembler afin de partager nos projets et notre vision du futur de l’association lors d’une assemblée générale mais surtout d’un moment convivial.

Et pour terminer, 2021 sera peut-être l’année de naissance d’un lieu fédérateur de partage, de création et de fabrication. Une fabrique de territoire qui aurait toute sa place en pays d’Iroise, et qui rassemblerait tous ceux qui désirent comprendre, apprendre et entreprendre.

Lampe chêne-leds

Bandeau leds 5V, interrupteur sensitif et planche de chêne …

Un petit projet tout simple : alimentation USB, bandeau leds 5V et un interrupteur sensitif lumineux, une résistance 1kΩ, un transistor NPN TIP31. Un total de 4 euros pour l’électronique et une chute de bois !!!
L’interrupteur envoi un signal 5V en cas de contact, donc utilisation d’un transistor NPN TIP31 pour effectuer le contact GND du bandeau led :

Mais où est la poussière ? eh bien comme souvent sous le tapis :

Covid 19 : Impression pièces pour masque de protection en lien avec l’ENSTA et le CHU

Voici les 2 pièces, les feuilles transparentes sont déjà à l’ENSTA

Suite à l’appel de l’ENSTA, voici un lien video pour les réglages de l’imprimante : https://www.youtube.com/watch?v=qQ7W-4auORE

En gros : Qualité draft (0.2), 1ere et dernière couche 1.2, remplissage 50%, pas de support, jupe pour préparer la buse.
PLA + imprimante 20 x 20 cm minimum

Voici les fichiers imprimés sur un plateau 20 X 20 cm

Voici les 2 fichiers stl validés à télécharger

Les pièces produites seront à déposer chez le gardien de l’ENSTA Bretagne:
https://www.ensta-bretagne.fr/fr/pour-acceder-lensta-bretagne

Un point de récupération pourra se faire à Saint-Renan. Merci de me contacter par mail pgondot(at)mac.com

Merci d’avance pour votre participation et faites le savoir !!!
Il y a besoin de 200 pièces pour le CHU Brest, mais d’autres peuvent être produites pour d’autres hôpitaux locaux, Ehpad, services infirmiers etc …

Nos meilleurs vœux

Une nouvelle année, un nouveau local, des nouveaux horaires, de nouvelles formations

2019 s’annonce pleine de créativité.
Notre local se situe 4 place du Vieux Marché, (dernier étage, au dessus de l’office de Tourisme)
Ouverture les samedis après-midi 14h30 – 18h30 et
les mardis soir 18h30 – 22h30
Formation : Fabriquez vous-même votre objet :
le mardi 22 janvier
Partie 1 : Initiation niveau 1 à FREECAD
(dessinez en 3D votre objet avec le logiciel gratuit de modélisation FREECAD)
le mardi 5 février
Partie 2 : Initiation à l’impression 3D
(imprimez votre objet avec l’imprimante 3D du FabLab)

C’est la rentrée !!!

Samedi 1 septembre reprises des activités, avec au menu :
Forum des associations de Saint-Renan le 8 septembre de 9h à 13h
Fête de la science au Quartz du 12 au 14 octobre

On vous attends nombreux et la tête pleine de projets

Quelques infos …

Merci, tout d’abord aux organisateurs et au public du salon du jeu à St-Renan. Beaucoup de visiteurs curieux et intéressés par les présentations du Fablab : Découpe laser, impression 3D, console Raspberry et montages électroniques.

Nous serons ouverts samedi prochain 14 avril à 14h30 au centre Culturel de St-Renan, mais il n’y aura exceptionnellement  pas d’ouverture les 21, 28 avril et 5 mai, reprise des ouvertures le 12 mai avec les ateliers découverte de l’Arduino et la fabrication de station météo, préparation de l’atelier fabrication de yukulele à l’école Notre Dame de Liesse. Et tous les autres projets en cours: réalisation domotique(David nous prépare un bel article !!!), construction d’une imprimante 3D (bravo Thomas pour l’avancement de ton projet).

Prise en main de l’arduino : la station météo

Pour finaliser ce projet on démarre par le commencement :

La carte Arduino Uno

et son interface de programmation

#include

void setup(){

}
void loop(){

}

prise en main avec quelques leds et boutons, puis l’écran LCD, puis le capteurs de température LM35, puis le DHT22, un peu de pression atmosphérique avec le BMP280. On programme tout cela et …

ce n’est pas fini car les plus courageux pourront apporter pleins de raffinements et un emballage super design.

 

Le jeu de 421 électronique

Un aperçu de ce que pourrait donner ce jeu de 421, avec un affichage lumineux dans des dalles d’Altuglas gravées.

L’affichage de la valeur d’un dé se fait avec seulement 4 « allumages » de led :

  1. une led centrale
  2. deux leds au milieu de chaque cotés
  3. une led en bas à gauche et une led en haut à droite, groupées. (+ le 1 bien sur)
  4. une led en haut à gauche et une led en bas à droite, groupées. (+ le 3 )
  5. = le 4 + le 3 et le 1
  6. = le 2 + le 3 et le 4

Un câblage qui utilise toutes les entrées-sorties de la carte ! :

  • 4 X 3 sorties leds pour les 3 dés
  • 4 entrées pour les boutons
  • 2 entrées pour l’affichage 7 segments

Un aperçu du programme arduino (à améliorer certes !)

#include "SevenSegmentTM1637.h"

const int D1_1 = 2; // the number of the pushbutton pin
const int D1_2 = 3; // the number of the pushbutton pin
const int D1_3 = 4; // the number of the pushbutton pin
const int D1_4 = 5; // the number of the pushbutton pin
const int D2_1 = 6; // the number of the pushbutton pin
const int D2_2 = 7; // the number of the pushbutton pin
const int D2_3 = 8; // the number of the pushbutton pin
const int D2_4 = 9; // the number of the pushbutton pin
const int D3_1 = 10; // the number of the pushbutton pin
const int D3_2 = 11; // the number of the pushbutton pin
const int D3_3 = 12; // the number of the pushbutton pin
const int D3_4 = 13; // the number of the pushbutton pin

const int Bt_1 = 15; // the number of the pushbutton pin
const int Bt_2 = 16; // the number of the pushbutton pin
const int Bt_3 = 17; // the number of the pushbutton pin
const int Bt_G = 14; // the number of the pushbutton pin
const byte PIN_CLK = 18; // define CLK pin (any digital pin)
const byte PIN_DIO = 19; // define DIO pin (any digital pin)

int Temps = 2000;
bool Bt_GState = 0;
bool Bt_1State = 0;
bool Bt_2State = 0;
bool Bt_3State = 0;
bool D1 = 0;
bool D2 = 0;
bool D3 = 0;
bool Jeu = 0; // jeu = 0 : charge ; jeu = 1 : decharge
bool Joueur = 0 ; //joueur1 = 0 : joueur2 = 1
bool Debut = 0 ; // debut = 0 joueur1 debute sinon joueur2
int Val = 0;
int Val1 = 0;
int Val2 = 0;
int Score = 0;
int Score1 = 0 ;
int Score2 = 0 ;
int Jetons1 = 0 ;
int Jetons2 = 0 ;
int Lance = 0; // si jeu = 1 lance = 3
int Pot = 21;
int Temp ;
String Seg;
 String ScoreT;
int Tirage[3];

SevenSegmentTM1637 display(PIN_CLK, PIN_DIO);

void setup() {
 Serial.begin(9600); // initializes the Serial connection @ 9600 baud
 display.begin(); // initializes the display
 display.setBacklight(100); // set the brightness to 100 %
 display.print("INIT"); // display INIT on the display


 pinMode(14, INPUT_PULLUP);
 pinMode(15, INPUT_PULLUP);
 pinMode(16, INPUT_PULLUP);
 pinMode(17, INPUT_PULLUP);
 for (int thisPin = 2; thisPin < 14; thisPin++) {
 pinMode(thisPin, OUTPUT);
 }
 randomSeed(analogRead(7));
 delay(Temps); // wait 1000 ms
 Efface();
 Affiche(1, 4);
 Affiche(2, 2);
 Affiche(3, 1);
 delay(Temps);
 Efface();
}

void loop() {

while (Pot < 22 && Pot > 0) { // phase de charge
 Jeu = false;
 
 if(!Joueur){
 Efface();
// Serial.print("Joueur : ");
// Serial.println(Joueur + 1);
 while(!Bt_GState && !Joueur) {
 AfficheJoueur(); 
 if (digitalRead(Bt_G) == LOW){ Bt_GState = 1;
 //Serial.println("Prêt au Lancement des dés");
 }
 LanceCharge();
 }
 }
 
 if(Joueur){
 Efface();
// Serial.print("Joueur : ");
// Serial.println(Joueur + 1);
 while(!Bt_GState && Joueur) {
 AfficheJoueur();
 if (digitalRead(Bt_G) == LOW){ Bt_GState = 1;
 Serial.println("Prêt au Lancement des dés J2");
 }
 LanceCharge();
 }
 }
 }
 if (Pot == 0 && Jeu == false) { // phase de decharge
 if (Jetons1 > Jetons2) {
 int tmp = Jetons1;
 Jetons1 = Jetons2;
 Jetons2 = tmp;
 }
 Jeu = true;
 display.clear();
 display.setColonOn(0);
 display.print("DECHARGE"); 
 Joueur = 0;
 AfficheJoueur();
// Serial.print("Passage en phase decharge : ");
// Serial.println(Jeu);
 Efface();
 }

while (Jetons1 > 0 && Jetons2 > 0 && Jeu == true) {
 
 if(!Joueur){
 
 while(!Bt_GState && !Joueur) {
 AfficheJoueur(); 
 Efface();
 if (digitalRead(Bt_G) == LOW){ Bt_GState = 1;Serial.println("Prêt au Lancement des dés");}
 
 if (Lance != 0) {
 if (digitalRead(Bt_1) == LOW){ Bt_1State = !Bt_1State;Serial.println("Verouillage D1");}
 if (digitalRead(Bt_2) == LOW){ Bt_2State = !Bt_2State;Serial.println("Verouillage D2");}
 if (digitalRead(Bt_3) == LOW){ Bt_3State = !Bt_3State;Serial.println("Verouillage D3");}
 
 if (Bt_1State){ D1=1; 
 Affiche(1, Tirage[0]);}
 if (Bt_2State){ D2=1; 
 Affiche(2, Tirage[1]);}
 if (Bt_3State){ D3=1; 
 Affiche(3, Tirage[2]);}
 }
 
 LanceDecharge();
 
}
 }
 if(Joueur){
 
 while(!Bt_GState && Joueur) {
 AfficheJoueur(); 
 Efface();
 if (digitalRead(Bt_G) == LOW){ Bt_GState = 1;Serial.println("Prêt au Lancement des dés");}

if (Lance != 0) {
 if (digitalRead(Bt_1) == LOW){ Bt_1State = !Bt_1State; }
 if (digitalRead(Bt_2) == LOW){ Bt_2State = !Bt_2State; }
 if (digitalRead(Bt_3) == LOW){ Bt_3State = !Bt_3State; }
 
 if (Bt_1State){ D1=1; 
 Affiche(1, Tirage[0]);}
 if (Bt_2State){ D2=1; 
 Affiche(2, Tirage[1]);}
 if (Bt_3State){ D3=1; 
 Affiche(3, Tirage[2]);}
 }


LanceDecharge();
}
}
 }
 if(Pot==0 && Jetons1==0){display.clear();
 display.setColonOn(0);
 display.print("JOUEUR 1 GAGNE"); 
 if (digitalRead(Bt_G) == LOW){
 Jeu = 0; Jetons1 = Jetons2 = 0 ; Pot = 21; display.clear(); display.print("Reset");}
 }
 if(Pot==0 && Jetons2==0){display.clear();
 display.setColonOn(0);
 display.print("JOUEUR 2 GAGNE"); 
 if (digitalRead(Bt_G) == LOW){
 Jeu = 0; Jetons1 = Jetons2 = 0 ; Pot = 21; display.clear(); display.print("Reset");}}
}
void Efface() {
 //if(!D1) {
 digitalWrite (D1_1, LOW);
 digitalWrite (D1_2, LOW);
 digitalWrite (D1_3, LOW);
 digitalWrite (D1_4, LOW);
 // }
 // if(!D2) {
 digitalWrite (D2_1, LOW);
 digitalWrite (D2_2, LOW);
 digitalWrite (D2_3, LOW);
 digitalWrite (D2_4, LOW);
 //}
 //if(!D3) {
 digitalWrite (D3_1, LOW);
 digitalWrite (D3_2, LOW);
 digitalWrite (D3_3, LOW);
 digitalWrite (D3_4, LOW);
 //}
}
void LanceCharge() {
 
 if (Bt_GState == 1 && Jeu == false) {
 Serial.println("Lancement des dés");
 //Efface();
 Tirage[0] = random(1, 7); Tirage[1] = random(1, 7); Tirage[2] = random(1, 7);

Tri();
 
// Serial.print("Tirage : ");
// Serial.print(Tirage[0]);
// Serial.print(Tirage[1]);
// Serial.println(Tirage[2]);

Affiche(1, Tirage[0]);
 Affiche(2, Tirage[1]);
 Affiche(3, Tirage[2]);
 delay (Temps);


CalculScore();
// Serial.println("Calcul score");
 if(Joueur){ CalculJetons();
 AfficheJetons();
 }
 Joueur = !Joueur;
// Serial.print("Passage au joueur : ");
// Serial.println(Joueur + 1);
 Bt_GState = 0; //Serial.println("Remise à zéro du lancement");
 }
}
void LanceDecharge() {
 
 if (Bt_GState == 1 && Jeu == true) {
 Lance += 1;
// Serial.print("N° lancement: "); Serial.println(Lance);
// Serial.print("D1-D2-D3 avant tirage : ");
// Serial.print(D1); Serial.print(D2); Serial.println(D3);
 
 if (Lance < 4){
 
 if (!D1) {Tirage[0] = random(1, 7);}
 if (!D2) {Tirage[1] = random(1, 7);}
 if (!D3) {Tirage[2] = random(1, 7);}

Tri();
 
// Serial.print("Tirage Décharge: ");
// Serial.print(Tirage[0]);
// Serial.print(Tirage[1]);
// Serial.println(Tirage[2]);

Efface();

Affiche(1, Tirage[0]);
 Affiche(2, Tirage[1]);
 Affiche(3, Tirage[2]);

Bt_1State = Bt_2State = Bt_3State = D1 = D2 = D3 = 0;
 
delay (Temps);
 
 
 
 if(Lance==3){
 CalculScore(); Lance = 0;
// Serial.println("Calcul score Décharge");
 if(Joueur){
 CalculJetons();
// Serial.println("Calcul jetons Décharge");
 AfficheJetons();
// Serial.println("Affiche Jetons Decharge");}
 Joueur = !Joueur;
// Serial.print("Passage au joueur : ");
// Serial.println(Joueur + 1);
 }
 }
 
 Bt_GState = 0; //Serial.println("Remise à zéro du lancement"); 
 }
}

void Affiche(int nd, int d) {
 if (d == 1) {
 if (nd == 1) {
 digitalWrite (D1_1, HIGH);
 }
 if (nd == 2) {
 digitalWrite (D2_1, HIGH);
 }
 if (nd == 3) {
 digitalWrite (D3_1, HIGH);
 }
 }
 if (d == 2) {
 if (nd == 1) {
 digitalWrite (D1_2, HIGH);
 }
 if (nd == 2) {
 digitalWrite (D2_2, HIGH);
 }
 if (nd == 3) {
 digitalWrite (D3_2, HIGH);
 }
 }
 if (d == 3) {
 if (nd == 1) {
 digitalWrite (D1_1, HIGH);
 digitalWrite (D1_3, HIGH);
 }
 if (nd == 2) {
 digitalWrite (D2_1, HIGH);
 digitalWrite (D2_3, HIGH);
 }
 if (nd == 3) {
 digitalWrite (D3_1, HIGH);
 digitalWrite (D3_3, HIGH);
 }
 }
 if (d == 4) {
 if (nd == 1) {
 digitalWrite (D1_4, HIGH);
 digitalWrite (D1_3, HIGH);
 }
 if (nd == 2) {
 digitalWrite (D2_4, HIGH);
 digitalWrite (D2_3, HIGH);
 }
 if (nd == 3) {
 digitalWrite (D3_4, HIGH);
 digitalWrite (D3_3, HIGH);
 }
 }
 if (d == 5) {
 if (nd == 1) {
 digitalWrite (D1_1, HIGH);
 digitalWrite (D1_3, HIGH);
 digitalWrite (D1_4, HIGH);
 }
 if (nd == 2) {
 digitalWrite (D2_1, HIGH);
 digitalWrite (D2_3, HIGH);
 digitalWrite (D2_4, HIGH);
 }
 if (nd == 3) {
 digitalWrite (D3_1, HIGH);
 digitalWrite (D3_3, HIGH);
 digitalWrite (D3_4, HIGH);
 }
 }
 if (d == 6) {
 if (nd == 1) {
 digitalWrite (D1_2, HIGH);
 digitalWrite (D1_3, HIGH);
 digitalWrite (D1_4, HIGH);
 }
 if (nd == 2) {
 digitalWrite (D2_2, HIGH);
 digitalWrite (D2_3, HIGH);
 digitalWrite (D2_4, HIGH);
 }
 if (nd == 3) {
 digitalWrite (D3_2, HIGH);
 digitalWrite (D3_3, HIGH);
 digitalWrite (D3_4, HIGH);
 }
 }
}
void Tri() {
 while (Tirage[0] < Tirage[1] || Tirage[0] < Tirage[2] || Tirage[1] < Tirage[2]) {
 if (Tirage[0] < Tirage[1]) {
 Temp = Tirage[0];
 Tirage[0] = Tirage[1];
 Tirage[1] = Temp;
 }
 if (Tirage[1] < Tirage[2]) {
 Temp = Tirage[1];
 Tirage[1] = Tirage[2];
 Tirage[2] = Temp;
 }
 }
}

void CalculScore() {
 // tri des des
 Tri();
 // combinaisons
 // 421
 if (Tirage[0] == 4 && Tirage[1] == 2 && Tirage[2] == 1 ) {
 Val = 100;
 (!Joueur) ? Val1 = Val : Val2 = Val;
 }
 
 // 111
 if (Tirage[0] == 1 && Tirage[1] == 1 && Tirage[2] == 1 ) {Val = 70;
(!Joueur) ? Val1 = Val : Val2 = Val;}
 
 // 666 - 611
 if ( Tirage[0] == Tirage[1] && Tirage[1] == Tirage[2] && Tirage[0] == 6 ) {Val = 66;
 (!Joueur) ? Val1 = Val : Val2 = Val;} 
 if ( Tirage[0] == 6 && Tirage[1] == 1 && Tirage[2] == 1 ) {Val = 65;
 (!Joueur) ? Val1 = Val : Val2 = Val;}
 
// 555 - 511
if ( Tirage[0] == Tirage[1] && Tirage[1] == Tirage[2] && Tirage[0] == 5 ) { Val = 55; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}
if ( Tirage[0] == 5 && Tirage[1] == 1 && Tirage[2] == 1 ) { Val = 54; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}

// 444 - 411
if ( Tirage[0] == Tirage[1] && Tirage[1] == Tirage[2] && Tirage[0] == 4 ) { Val = 44; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}
if ( Tirage[0] == 4 && Tirage[1] == 1 && Tirage[2] == 1 ) { Val = 43; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}
 
// 333 - 311
if ( Tirage[0] == Tirage[1] && Tirage[1] == Tirage[2] && Tirage[0] == 3 ) { Val = 33; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}
if ( Tirage[0] == 3 && Tirage[1] == 1 && Tirage[2] == 1 ) { Val = 32; 
 (!Joueur) ? Val1 = Val : Val2 = Val;
 }
// 222 - 211
if ( Tirage[0] == Tirage[1] && Tirage[1] == Tirage[2] && Tirage[0] == 2 ) { Val = 22; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}
if ( Tirage[0] == 2 && Tirage[1] == 1 && Tirage[2] == 1 ) { Val = 21; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}
 
// Suites
if ( Tirage[0] == 6 && Tirage[1] == 5 && Tirage[2] == 4 ) { Val = 20; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}
 if ( Tirage[0] == 5 && Tirage[1] == 4 && Tirage[2] == 3 ) { Val = 19; 
(!Joueur) ? Val1 = Val : Val2 = Val;}
 if ( Tirage[0] == 4 && Tirage[1] == 3 && Tirage[2] == 2 ) { Val = 18; 
(!Joueur) ? Val1 = Val : Val2 = Val;}
 if ( Tirage[0] == 3 && Tirage[1] == 2 && Tirage[2] == 1 ) { Val = 17; 
(!Joueur) ? Val1 = Val : Val2 = Val;}

//221 Nenette
if ( Tirage[0] == 2 && Tirage[1] == 2 && Tirage[2] == 1 ) { Val = 16; 
 (!Joueur) ? Val1 = Val : Val2 = Val;}

// Hors combinaisons
if ( Val1 == 0 && Val2 == 0){ 
Val =Tirage[0] * 100 + Tirage[1] * 10 + Tirage[2];
Val1 = Val; 
 //Serial.print("Hors combinaison J1 : ");
 //Serial.println(Val1);
} 
if (Val1>100 && Val2==0 && Joueur) { Val = 0;
 Val =Tirage[0] * 100 + Tirage[1] * 10 + Tirage[2];
Val2 = Val; 
 //Serial.print("Hors combinaison J2 : ");
 //Serial.println(Val2);
}

if (Joueur) {
 if ( Val1 - Val2 == 0 ) { Score1 = 0; Score2 = 0;}
 if ((Val1 <101 && Val1 > Val2 )||(Val1 <101 && Val2 > 100 )) {Score2 = 0;
 switch(Val1){
 case(100): Score1 = 10;break;
 case(70): Score1 = 7;break;
 case(66): Score1 = 6;break;
 case(65): Score1 = 6;break;
 case(55): Score1 = 5;break;
 case(54): Score1 = 5;break;
 case(44): Score1 = 4;break;
 case(43): Score1 = 4;break;
 case(33): Score1 = 3;break;
 case(32): Score1 = 3;break;
 case(22): Score1 = 2;break;
 case(21): Score1 = 2;break;
 case(20): Score1 = 2;break;
 case(19): Score1 = 2;break;
 case(18): Score1 = 2;break;
 case(17): Score1 = 2;break;
 case(16): Score1 = 4;break;
 default: Score1 = 1;break; 
 }
 }
 if ((Val2<101 && Val1 < Val2 )||(Val2 <101 && Val1 > 100 )) {Score1 = 0;
 switch(Val2){
 case(100): Score2 = 10;break;
 case(70): Score2 = 7;break;
 case(66): Score2 = 6;break;
 case(65): Score2 = 6;break;
 case(55): Score2 = 5;break;
 case(54): Score2 = 5;break;
 case(44): Score2 = 4;break;
 case(43): Score2 = 4;break;
 case(33): Score2 = 3;break;
 case(32): Score2 = 3;break;
 case(22): Score2 = 2;break;
 case(21): Score2 = 2;break;
 case(20): Score2 = 2;break;
 case(19): Score2 = 2;break;
 case(18): Score2 = 2;break;
 case(17): Score2 = 2;break;
 case(16): Score2 = 4;break;
 default: Score2 = 1;break; 
 }
 }
 if(Val1>100 && Val2>100) {
 if (Val1==Val2) { Score1=Score2=0 ; //Serial.println("Egalité Hors combinaison ");
 }
 if(Val1>Val2){ Score1=1;}
 if(Val2>Val1){ Score2=1;}
 }
 
 //Serial.print("Valeur Val1 : ");
// Serial.println(Val1);
// Serial.print("Valeur Val2 : ");
// Serial.println(Val2);
 Val1 = Val2 = 0;
// Serial.print("Calcul du score : ");
// Serial.println(Score1 + Score2);
}

}
 
void CalculJetons() {
 if (!Jeu) {
 if (Score1 > Pot) {
 Score1 = Pot;
 }
 if (Score2 > Pot) {
 Score2 = Pot;
 }
 if (Score1 > Score2) {
 Jetons2 = Jetons2 + Score1;
 }
 if (Score2 > Score1) {
 Jetons1 = Jetons1 + Score2;
 }
 Pot = Pot - Score1 - Score2;
 Score1 = Score2 = 0;
 
// Serial.print("Calcul du pot : ");
// Serial.println(Pot);
 }
 if(Jeu) {
 if (Score1 > Score2) {
 if (Score1 > Jetons1) {
 Score1 = Jetons1;
 }
 Jetons2 = Jetons2 + Score1;
 Jetons1 = Jetons1 - Score1;
 }
 if (Score2 > Score1) {
 if (Score2 > Jetons2) {
 Score2 = Jetons2;
 }
 Jetons1 = Jetons1 + Score2;
 Jetons2 = Jetons2 - Score2;
 }
 Score1 = Score2 = 0;
 }
 
}
void AfficheJetons(){
String str1;
 str1="J2";
String str2 = String(Jetons2);
if(Jetons2>=0 && Jetons2<=9){str2 = '0'+ str2;}
String str0 = str1 + str2;
display.clear();
 display.setColonOn(1);
 display.print(str0); // display LOOP on the display
delay(Temps); 
String str3;
 str3="J1";
String str4 = String(Jetons1);
if(Jetons1>=0 && Jetons1<=9){str4 = '0'+ str4;}
String str = str3 + str4;
display.clear();
 display.setColonOn(1);
 display.print(str); // display LOOP on the display 
delay(Temps);

// Serial.print("Jetons joueur 1 : ");
// Serial.println(Jetons1);
// Serial.print("Jetons joueur 2 : ");
// Serial.println(Jetons2);
}
void AfficheJoueur(){
 String str1;
(Joueur) ? str1="J2" : str1= "J1";
display.clear();
 display.setColonOn(1);
 display.print(str1); // display LOOP on the display
display.blink(); 
}

Voilà