Program problem for my diploma

Hello I am a French student and I pass my BAC (Diploma to access Higher education) at the end of the year and I have a problem with my program it does not work could you help me please thank you very much
It’s very important

Here is my program :
#include <SdFat.h>
#include <GSM.h>
#define PINNUMBER “”
GSM gsmAccess;
GSM_SMS sms;
SdFat carteSD;
SdFile fichier; // fichier pour les données
const byte SD_PIN = 4; // port de la carte SD (ne pas changer)

unsigned long t0 = 0; // variable pour le timer
const unsigned long periode = 1000; // période d’enregistrement (en ms)
bool notConnected = true;
void setup() {
Serial.begin(9600);
// Initialisation de la carte SD
carteSD.begin(SD_PIN);

// Mise à zéro du timer
t0 = millis();
}

void loop() {
unsigned long t = millis();

if (t-t0 > periode) {
t0 = t;
EcrireDonnees(t);
}

// Autres opérations à réaliser …
delay(100);
}

void EcrireDonnees(unsigned long t) {
// Acquisition des données
float donnee = float(analogRead(A0)) / 180;

// Enregistrement des données
if (fichier.open(“donnees.csv”, O_RDWR | O_CREAT | O_AT_END)) {
fichier.print(t);
fichier.print(",");
fichier.println(donnee, 1);

fichier.close(); // fermeture du fichier
}
}

// initialize the library instance

// initialize serial communications and wait for port to open:

while (!Serial) {
// wait for serial port to connect. Needed for native USB port only
}
Serial.println(“SMS Messages Sender”);

// connection state

// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (notConnected) {
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
Serial.println(“Not connected”);
delay(1000);
}
}

Serial.println(“GSM initialized”);
}

void loop() {

Serial.print("Enter a mobile number: ");
char remoteNum[20]; // telephone number to send sms
readSerial(remoteNum);
Serial.println(remoteNum);

// sms text
Serial.print("Now, enter SMS content: ");
char txtMsg[200];
readSerial(txtMsg);
Serial.println(“SENDING”);
Serial.println();
Serial.println(“Message:”);
Serial.println(txtMsg);

// send the message
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}

/*
Read input serial
*/
int readSerial(char result) {
int i = 0;
while (1) {
while (Serial.available() > 0) {
char inChar = Serial.read();
if (inChar == ‘\n’) {
result = ‘\0’;

  • Serial.flush();*
  • return 0;*
  • }*
  • if (inChar != ‘\r’) {*
    _ result = inChar;_
    * i++;*
    * }*
    * }*
    * }*
    }
    And when I compile it tells me: exit status 1
    expected unqualified-id before ‘while’
    arduino_programme.ino (2.49 KB)

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn’t show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you’re using the Arduino Web Editor you will not have access to this useful tool but it’s still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

Please remove unnecessary blank lines from your code before posting to the forum. One or two to separate code into logical sections is fine but large spaces for no reason or random blank lines just make for more scrolling when we’re trying to read your code.

When you encounter an error you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).

You have two loop() functions.

All the code between the EcrireDonnees() function and the second loop() function is not in a function. ALL executable code must be in a function.