César est la clef
Sommaire
photo de l'équipe
Que fait ce projet ?
Nous sommes un groupe d'étudiants de l'ENIB : Elouan, Arthur, Sidiki et Sylane (de gauche à droite).
Les sites utiles
- https://steve.fi/hardware/d1-pins/
- https://randomnerdtutorials.com/esp32-esp8266-i2c-lcd-arduino-ide/
- https://chat.openai.com/chat
Liste des composants
- composant 1
- composant 2
- ...
Code
Le code n'est pas malheureusement pas opérationnel. Nous avons eu beaucoup de difficultés à connecter le microcontrôleur à notre pc.
- include <LiquidCrystal_I2C.h>
- include <Arduino.h>
- include <String.h>
bool e0= false; bool e1=false;
// set the LCD number of columns and rows
int lcdColumns = 16;
int lcdRows = 2;
// set LCD address, number of columns and rows // if you don't know your display address, run an I2C scanner sketch LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);
void setup(){
pinMode(D0, INPUT); pinMode(D5,INPUT); pinMode(D6,INPUT); // initialize LCD lcd.init(); // turn on LCD backlight lcd.backlight(); lcd.clear(); // set cursor to first column, first row // lcd.setCursor(0, 0); // print message // lcd.print("Hello, World!"); // Serial.begin(115200); // Serial.println(random(0,100));
}
char char1 = (char)0x41 +(char)random(0,25); char char2 = (char)0x41 +(char)random(0,25); char char3 = (char)0x41 +(char)random(0,25);
//String TrueString =(String)(char1+(char)7) +(String)(char2+(char)7) + (String)(char3+(char)7); //int cmpt =0;
String chain1=(String)char1 +(String)char2 + (String)char3;
int shift=0;
void DisplayCode(String Chain,int dec,int sh){
lcd.setCursor(0, 0); lcd.print("Mon code est:"); lcd.setCursor(0, 14); lcd.print(sh); lcd.setCursor(dec, 1); lcd.print(Chain);
}
void Increment() { if (char1 =='Z' || char2 =='Z' || char3 =='Z'){
char1 = (char)((int)char1-25); char2 = (char)((int)char1-25); char3 = (char)((int)char1-25);
shift++; if (shift>=26){
shift=0;
}
chain1=(String)char1 +(String)char2 + (String)char3; DisplayCode(chain1, 7, shift);
}
else{
char1 = (char)((int)char1+1); char2 = (char)((int)char2+1); char3 = (char)((int)char3+1);
shift++; if (shift>=26){
shift=0;
} chain1=(String)char1 +(String)char2 + (String)char3; DisplayCode(chain1, 7, shift);
}
}
void Decrement(){
if (char1 =='A' || char2 =='A' || char3 =='A'){
char1 = (char)((int)char1+25); char2 = (char)((int)char2+25); char3 = (char)((int)char3+25);
shift--; if (shift<0){
shift=25;
} chain1=(String)char1 +(String)char2 + (String)char3; DisplayCode(chain1, 7, shift);
} else{
char1 = (char)((int)char1-1); char2 = (char)((int)char2-1); char3 = (char)((int)char3-1);
shift--; if (shift<0){
shift=25;
} chain1=(String)char1 +(String)char2 + (String)char3; DisplayCode(chain1, 7, shift);
} }
void loop(){
while (!e0){ DisplayCode(chain1, 7, shift);
if (digitalRead(D5==HIGH )){ Increment(); } if (digitalRead(D6==HIGH)){ Decrement(); }
if(shift==7 && D0==HIGH){
e0=true;
}
delay(1000); Decrement(); lcd.clear(); }
}