Bonjour,
Voici mon code :
#include <SD.h>
#include <Deuligne.h>
#include <Wire.h>
File Dico;
Deuligne lcd;
const int SDPIN = 53;
const int BOUTON = 31;
int L1 = 33;
int L2 = 33;
int L3 = 33;
int L4 = 33;
int L5 = 33;
int L6 = 33;
int L7 = 33;
int L8 = 33;
int stopPG1 = 0;
int stopPG2 = 0;
int serialint = 0;
char serialchar;
String serial;
void setup()
{
lcd.init();
Serial.begin(9600);
Serial.println ("Initialisation de la carte SD...");
lcd.backLight(true);
lcd.print ("Initialisation");
lcd.setCursor(0,1);
lcd.print ("Carte SD...");
delay(2500);
lcd.clear();
lcd.backLight(false);
pinMode(SDPIN, OUTPUT);
pinMode(BOUTON, INPUT);
if (!SD.begin(SDPIN)) {
Serial.println("SD invalide ou absente");
lcd.backLight(true);
lcd.print ("SD invalide ou");
lcd.setCursor (0,1);
lcd.print ("Absente");
delay(2500);
lcd.clear();
lcd.backLight(false);
}else{
Serial.println("SD OK");
lcd.backLight(true);
lcd.print ("SD OK");
delay(2500);
lcd.clear();
lcd.backLight(false);
Dico = SD.open("Dico.txt", FILE_WRITE);
if (Dico) {
Serial.println("Création du dictionaire");
}else{
Serial.println("Le fichier dico.txt ne c'est pas ouvert");}}}
void loop(){
while (Serial.available()) {
serialchar = (char)Serial.read();
serial += serialchar;
serialint = 1;
}
if (serialint == 1){
if (serial == "STOP"){
Dico.close();
Dico = SD.open("STOPAUSE.txt", FILE_WRITE);
Dico.print (L1);
Dico.println (L3);
Dico.println (L4);
Dico.println (L5);
Dico.println (L6);
Dico.println (L7);
Dico.println (L8);
Dico.close();
stopPG1 = 1;
Serial.println("!!!!!!!!STOP!!!!!!!!");
Serial.println("Sauvegarde éffectuée");
}
if (serial == "PAUSE"){
Dico.close();
Dico = SD.open("STOPAUSE.txt", FILE_WRITE);
Dico.print (L1);
Dico.println (L3);
Dico.println (L4);
Dico.println (L5);
Dico.println (L6);
Dico.println (L7);
Dico.println (L8);
Dico.close();
stopPG2 = 1;
Serial.println("!!!!!!!!PAUSE!!!!!!!!");
Serial.println("Sauvegarde éffectuée");
}
if (serial == "PLAY"){
Dico.close();
Dico = SD.open("STOPAUSE.txt", FILE_WRITE);
Dico.print (L1);
Dico.println (L3);
Dico.println (L4);
Dico.println (L5);
Dico.println (L6);
Dico.println (L7);
Dico.println (L8);
Dico.close();
stopPG2 = 0;
Serial.println("!!!!!!!!PLAY!!!!!!!!");
}
}
if (stopPG1 == 0){
if (stopPG2 == 0){
L1++;
if (L1 == 127){
L1 = 33;
L2++;
if (L2 == 127){
L2 = 33;
L3++;
if (L3 == 127){
L3 = 33;
L4++;
if (L4 == 127){
L4 = 33;
L5++;
if (L5 == 127){
L5 = 33;
L6++;
if (L6 == 127){
L6 = 33;
L7++;
if (L8 == 127){
stopPG1 = 1;
}
}
}
}
}
}
}
Dico.write (L8);
Dico.write (L7);
Dico.write (L6);
Dico.write (L5);
Dico.write (L4);
Dico.write (L3);
Dico.write (L2);
Dico.write (L1);
Dico.println();
Dico.close();
Dico = SD.open("Dico.txt", FILE_WRITE);
}
}
}
ainsi qu'un capture d'écran : (la photo n'est pas entière, ouvrez-là dans un autre onglet)
Mon problème : Le programme ne veurt pas téléverser mon programme !!
Quelqu'un peut m'aider ?