From e1ac1fe72bcbbb8d4e3304899126972b1b7351ae Mon Sep 17 00:00:00 2001 From: gribse Date: Fri, 8 Dec 2023 18:46:07 +0000 Subject: [PATCH] initial commit --- reborn/afficheur_7seg_Achille_Toupin.ino | 238 +++++++++++++++++++++ reborn/dekalo_reborn.ino | 251 +++++++++++++++++++++++ reborn/serial_send_dekalo.ino | 250 ++++++++++++++++++++++ 3 files changed, 739 insertions(+) create mode 100644 reborn/afficheur_7seg_Achille_Toupin.ino create mode 100644 reborn/dekalo_reborn.ino create mode 100644 reborn/serial_send_dekalo.ino diff --git a/reborn/afficheur_7seg_Achille_Toupin.ino b/reborn/afficheur_7seg_Achille_Toupin.ino new file mode 100644 index 0000000..1574603 --- /dev/null +++ b/reborn/afficheur_7seg_Achille_Toupin.ino @@ -0,0 +1,238 @@ +#include + + +//fastled +#define NUM_LEDS 200 //7 * 9 * 2 + 2*2(points) +#define DATA_PIN 3 +CRGB leds[NUM_LEDS]; // Define the array of leds + + +void setup() +{ + //Serial + Serial.begin(9600); + + //FASTLED + FastLED.addLeds(leds, NUM_LEDS); + + //RAZ de l'afficheur + sevensegment(String(" "), 1, false); + + +} + + + + +void sevensegment(String displayString, short displayColor, bool displayPoints) //2 strings +{ + + //Serial.println("Entrée dans sevensegment"); + + //RAZ + for(int i=0; i<140; i++) + { + leds[i] = CRGB::Black; + } + + //transformer le string en une matrice de 9caractères + + int numSpaces = 9 - displayString.length(); + + for(int i=0; i on"); + } + else + { + leds[i*7*2 +(j)*2 + k] = CRGB::Black; + //test[i*7*2 +(j)*2 + k] = 2; + //Serial.println(" -> off"); + } + + } + } + } + } + + //points + + if(displayPoints == true) + { + //éteindre les points + for(int m=126; m<=140; m++) + { + if(displayColor == 1){leds[m] = CRGB::Red;} + else if(displayColor == 2){leds[m] = CRGB::Blue;} + else if(displayColor == 3){leds[m] = CRGB::Green;} + else if(displayColor == 4){leds[m] = CRGB::Yellow;} + else if(displayColor == 5){leds[m] = CRGB::Pink;} + } + } + else + { + //allumer les points + for(int m=126; m<=140; m++) + { + leds[m] = CRGB::Black; //adapter les points à la couleur de displaycolor + } + } + + FastLED.show(); + //Serial.println("fastled.show()"); +} + + +void loop() +{ + + + //couleurs : + //1 = Red + //2 = Blue + //3 = Green + //4 = Yellow + //5 = Pink + + + String messageStr = "123456789"; + + sevensegment(messageStr, 3, true); + + + /* + for(int i=51*60; i>=0; i--) + { + sevensegment(String(i), 1, false); + delay(1000); + } + */ + +} diff --git a/reborn/dekalo_reborn.ino b/reborn/dekalo_reborn.ino new file mode 100644 index 0000000..2d51c02 --- /dev/null +++ b/reborn/dekalo_reborn.ino @@ -0,0 +1,251 @@ +#include + + +//fastled +#define NUM_LEDS 200 //7 * 9 * 2 + 2*2(points) +#define DATA_PIN 3 +CRGB leds[NUM_LEDS]; // Define the array of leds + + +void setup() +{ + //Serial + Serial.begin(9600); + + //FASTLED + FastLED.addLeds(leds, NUM_LEDS); + + //RAZ de l'afficheur + sevensegment(String(" "), 1, false); + + //serial envoyage de chiffres + + + + + +} + + + + +void sevensegment(String displayString, short displayColor, bool displayPoints) //2 strings +{ + + //Serial.println("Entrée dans sevensegment"); + + //RAZ + for(int i=0; i<140; i++) + { + leds[i] = CRGB::Black; + } + + //transformer le string en une matrice de 9caractères + + int numSpaces = 9 - displayString.length(); + + for(int i=0; i on"); + } + else + { + leds[i*7*2 +(j)*2 + k] = CRGB::Black; + //test[i*7*2 +(j)*2 + k] = 2; + //Serial.println(" -> off"); + } + + } + } + } + } + + //points + + if(displayPoints == true) + { + //éteindre les points + for(int m=126; m<=140; m++) + { + if(displayColor == 1){leds[m] = CRGB::Red;} + else if(displayColor == 2){leds[m] = CRGB::Blue;} + else if(displayColor == 3){leds[m] = CRGB::Green;} + else if(displayColor == 4){leds[m] = CRGB::Yellow;} + else if(displayColor == 5){leds[m] = CRGB::Pink;} + } + } + else + { + //allumer les points + for(int m=126; m<=140; m++) + { + leds[m] = CRGB::Black; //adapter les points à la couleur de displaycolor + } + } + + FastLED.show(); + //Serial.println("fastled.show()"); +} + + +void loop() +{ + + + //couleurs : + //1 = Red + //2 = Blue + //3 = Green + //4 = Yellow + //5 = Pink + + + String messageStr = "123456789"; + + sevensegment(messageStr, 3, true); + + + if(Serial.available()){ + Serial.print("Rentrer le nombre à écrire : " ); + messageStr = Serial.read(); + Serial.print("Tu as écrit : " ); + Serial.println(messageStr); + sevensegment(messageStr, 1, false); + } + + /* + for(int i=51*60; i>=0; i--) + { + sevensegment(String(i), 1, false); + delay(1000); + } + */ + +} diff --git a/reborn/serial_send_dekalo.ino b/reborn/serial_send_dekalo.ino new file mode 100644 index 0000000..7d5fa90 --- /dev/null +++ b/reborn/serial_send_dekalo.ino @@ -0,0 +1,250 @@ +#include + + +//fastled +#define NUM_LEDS 200 //7 * 9 * 2 + 2*2(points) +#define DATA_PIN 3 +CRGB leds[NUM_LEDS]; // Define the array of leds + + +void setup() +{ + //Serial + Serial.begin(9600); + + //FASTLED + FastLED.addLeds(leds, NUM_LEDS); + + //RAZ de l'afficheur + sevensegment(String(" "), 1, false); + + String messageStr = "123456789"; + + + + +} + + + + +void sevensegment(String displayString, short displayColor, bool displayPoints) //2 strings +{ + + //Serial.println("Entrée dans sevensegment"); + + //RAZ + for(int i=0; i<140; i++) + { + leds[i] = CRGB::Black; + } + + //transformer le string en une matrice de 9caractères + + int numSpaces = 9 - displayString.length(); + + for(int i=0; i on"); + } + else + { + leds[i*7*2 +(j)*2 + k] = CRGB::Black; + //test[i*7*2 +(j)*2 + k] = 2; + //Serial.println(" -> off"); + } + + } + } + } + } + + //points + + if(displayPoints == true) + { + //éteindre les points + for(int m=126; m<=140; m++) + { + if(displayColor == 1){leds[m] = CRGB::Red;} + else if(displayColor == 2){leds[m] = CRGB::Blue;} + else if(displayColor == 3){leds[m] = CRGB::Green;} + else if(displayColor == 4){leds[m] = CRGB::Yellow;} + else if(displayColor == 5){leds[m] = CRGB::Pink;} + } + } + else + { + //allumer les points + for(int m=126; m<=140; m++) + { + leds[m] = CRGB::Black; //adapter les points à la couleur de displaycolor + } + } + + FastLED.show(); + //Serial.println("fastled.show()"); +} + + +void loop() +{ + + + //couleurs : + //1 = Red + //2 = Blue + //3 = Green + //4 = Yellow + //5 = Pink + + + + + //sevensegment(messageStr, 3, true); + + delay(1000); + if(Serial.available()){ + Serial.print("Rentrer le nombre à écrire : " ); + messageStr = Serial.read(); + Serial.print("Tu as écrit : " ); + Serial.println(messageStr); + sevensegment(messageStr, 1, false); + } + + /* + for(int i=51*60; i>=0; i--) + { + sevensegment(String(i), 1, false); + delay(1000); + } + */ + +}