Spo2 micro - controleurs Esp - 32 erreur téléversement

bonjour je travaille sur un projet de capteurs SpO2 relié a un microcontrôleurs Esp - 32 ce projet est pour mon épreuve du bac.

Quand je veux téléversé sur le microcontrôleur
IDE Arduino me mets un message d'erreurs que je n'arrive pas a comprendre.
Je vous mets le ci - dessous le message d'erreurs, et le le script du programme.
Pourriez vous m'aider s'il vous plaît .
Merci d'avance.

code d'erreurs:

test:58:1: error: 'Serial' does not name a type
 Serial.begin(115200);
 ^
test:59:1: error: 'Serial' does not name a type
 Serial.println("Initializing...");
 ^
test:60:1: error: 'Blynk' does not name a type
 Blynk.begin(auth, ssid, pass);
 ^
test:63:1: error: expected unqualified-id before 'while'
 while (!particle.Sensor.begin(Wire, I2C_SPEED_FAST))) //Use default I2C port, 400kHz speed

programme Arduino:

/*
  ## Hardware Connections (ESP32 Arduino):
  -VIN = 3.3V
  -GND = GND
  -SDA = 21 (or SDA)
  -SCL = 22 (or SCL)

*/
#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

#include <Wire.h>
#include "MAX30105.h" //sparkfun MAX3010X library
#include "heartRate.h"
MAX30105 particleSensor;

//#define MAX30105 //if you have Sparkfun's MAX30105 breakout board , try #define MAX30105

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "****"; // Token you received on your email, Replace with stars

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*****"; // Replace stars with Wifi Name/SSID
char pass[] = "*****"; //Replace stars with Wifi Password

double avered = 0; double aveir = 0;
double sumirrms = 0;
double sumredrms = 0;
int i = 0;
int Num = 100;//calculate SpO2 by this sampling interval

double ESpO2 = 95.0;//initial value of estimated SpO2
double FSpO2 = 0.7; //filter factor for estimated SpO2
double frate = 0.95; //low pass filter for IR/red LED value to eliminate AC component
#define TIMETOBOOT 3000; // wait for this time(msec) to output SpO2
#define SCALE 88.0; //adjust to display heart beat and SpO2 in the same scale
#define SAMPLING 5; //if you want to see heart beat more precisely , set SAMPLING to 1
#define FINGER_ON 30000; // if red signal is lower than this , it indicates your finger is not on the sensor
#define MINIMUM_SPO2 80.0;

const byte RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred
float beatsPerMinute;
int beatAvg;


#define USEFIFO
void setup();

Serial.begin(115200);
Serial.println("Initializing...");
Blynk.begin(auth, ssid, pass);

// Initialize sensor
while (!particle.Sensor.begin(Wire, I2C_SPEED_FAST))) //Use default I2C port, 400kHz speed
{
  Serial.println("MAX30102 was not found. Please check wiring/power/solder jumper at MH-ET LIVE MAX30102 board. ");
  //while (1);


  //Setup to sense a nice looking saw tooth on the plotter
  byte ledBrightness = 0x7F; //Options: 0=Off to 255=50mA
  byte sampleAverage = 4; //Options: 1, 2, 4, 8, 16, 32
  byte ledMode = 2; //Options: 1 = Red only, 2 = Red + IR, 3 = Red + IR + Green
  //Options: 1 = IR only, 2 = Red + IR on MH-ET LIVE MAX30102 board
  int sampleRate = 200; //Options: 50, 100, 200, 400, 800, 1000, 1600, 3200
  int pulseWidth = 411; //Options: 69, 118, 215, 411
  int adcRange = 16384; //Options: 2048, 4096, 8192, 16384
  // Set up the wanted parameters
  particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); //Configure sensor with these settings

  particleSensor.enableDIETEMPRDY();

  void loop()
  {

    uint32_t ir, red , green;
    double fred, fir;
    double SpO2 = 0; //raw SpO2 before low pass filtered

#ifdef USEFIFO
    particleSensor.check(); //Check the sensor, read up to 3 samples

    while (particleSensor.available()) {//do we have new data
#ifdef MAX30105
      red = particleSensor.getFIFORed(); //Sparkfun's MAX30105
      ir = particleSensor.getFIFOIR();  //Sparkfun's MAX30105
#else
      red = particleSensor.getFIFOIR(); //why getFOFOIR output Red data by MAX30102 on MH-ET LIVE breakout board
      ir = particleSensor.getFIFORed(); //why getFIFORed output IR data by MAX30102 on MH-ET LIVE breakout board
#endif



      i++;
      fred = (double)red;
      fir = (double)ir;
      avered = avered * frate + (double)red * (1.0 - frate);//average red level by low pass filter
      aveir = aveir * frate + (double)ir * (1.0 - frate); //average IR level by low pass filter
      sumredrms += (fred - avered) * (fred - avered); //square sum of alternate component of red level
      sumirrms += (fir - aveir) * (fir - aveir);//square sum of alternate component of IR level
      if ((i % SAMPLING) == 0) {//slow down graph plotting speed for arduino Serial plotter by thin out
        if ( millis() > TIMETOBOOT) {
          float ir_forGraph = (2.0 * fir - aveir) / aveir * SCALE;
          float red_forGraph = (2.0 * fred - avered) / avered * SCALE;
          //trancation for Serial plotter's autoscaling
          if ( ir_forGraph > 100.0) ir_forGraph = 100.0;
          if ( ir_forGraph < 80.0) ir_forGraph = 80.0;
          if ( red_forGraph > 100.0 ) red_forGraph = 100.0;
          if ( red_forGraph < 80.0 ) red_forGraph = 80.0;
          //        Serial.print(red); Serial.print(","); Serial.print(ir);Serial.print(".");
          if (ir < FINGER_ON) ESpO2 = MINIMUM_SPO2; //indicator for finger detached
          float temperature = particleSensor.readTemperatureF();
          Blynk.run();
          Blynk.virtualWrite(V4, ESpO2 );
          Serial.print(" Oxygen % = ");
          Serial.println(ESpO2);
        }
      }
      if ((i % Num) == 0) {
        double R = (sqrt(sumredrms) / avered) / (sqrt(sumirrms) / aveir);
        // Serial.println(R);
        SpO2 = -23.3 * (R - 0.4) + 100; //http://ww1.microchip.com/downloads/jp/AppNotes/00001525B_JP.pdf
        ESpO2 = FSpO2 * ESpO2 + (1.0 - FSpO2) * SpO2;//low pass filter
        //  Serial.print(SpO2);Serial.print(",");Serial.println(ESpO2);
        sumredrms = 0.0; sumirrms = 0.0; i = 0;
        break;
      }
      particleSensor.nextSample(); //We're finished with this sample so move to next sample
      //Serial.println(SpO2);
    }
#endif
  }

Bonjour,

Mets ton code entre balises de code. Tel quel c'est illisible!

La première erreur que je vois c'est ici:

Il y a un ; à la place du {

On vous a demandé le code entre balises de code, pas de le virer...

bonjours comment on fait pour mettre en balise ?
merci d'avance

c'est expliqué si vous lisez "Les bonnes pratiques du Forum Francophone” qui est épinglé en haut du forum, bien visible...

merci pour le guide je viens de le mettre en ligne

vous avez un souci, il n'y a pas de fonction setup() correcte (manque les accolades, faut virer le ; qui est après) et il doit aussi manquer d'autres accolades

Si vous indentez le code correctement dans l'IDE (en pressant ctrlT sur PC ou cmdT sur un Mac) vous verrez que le formatage montre que ce n'est pas équilibré

bonjour je voudrais savoir se que vous en penser par rapport au message d'erreurs.
merci d'avance pour votre réponse.

Tu as déjà corrigé les erreurs qui t'ont été signalées?

j'ai essayer mais je n'arrive pas a comprendre ou sont les erreurs.
( je viens de débuter dans l’Arduino)

Commence déjà par remplacer le ; après void setup() par { et fermer le setup par un } avant void loop(). C'est le type d'erreur qui en provoque d'autres en cascade. Ca ne sert à rien d'aller plus loin avant d'avoir corrigé ça.
Formates aussi ton code comme indiqué par JML.

Une fois ces mises en forme de message et correction de bug d'accolade faites, sur un ESP32 je conseille de remplacer la ligne :

Serial.begin(115200);

Par les quatre lignes:

delay (200) ;
Serial.begin(115200);
while (!Serial) ;
delay (200) ;

Ca donne du temps au processeur de basculer entre le mode téléchargement et le mode dialogue console.

bonsoirs j'ai suivi vos conseil et effectivement sa a porté c'est fruits. merci de votre aide.
bonne soirées.

bonsoir je voulais vous dire merci pour vos conseils je test ça tout de suite et je vous dit si le problème est résolut.
bonne soirée.

bonsoir sa a bien fonctionné le problème est que il a eu un nouveaux message d'erreurs. je vos le mets ci - dessous. bonne soirées.

[code]
test:94:1: error: 'particleSensor' does not name a type
 particleSensor.check(); //Check the sensor, read up to 3 samples
 ^
test:96:1: error: expected unqualified-id before 'while'
 while (particleSensor.available()) {//do we have new data 

Remets ton code corrigé.

je le remet si dessous

[code]
/*
  ## Hardware Connections (ESP32 Arduino):
  -VIN = 3.3V
  -GND = GND
  -SDA = 21 (or SDA)
  -SCL = 22 (or SCL)

*/
#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

#include <Wire.h>
#include "MAX30105.h" //sparkfun MAX3010X library
#include "heartRate.h"
MAX30105 particleSensor;

//#define MAX30105 //if you have Sparkfun's MAX30105 breakout board , try #define MAX30105

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "******"; // Token you received on your email, Replace with stars

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*****"; // Replace stars with Wifi Name/SSID
char pass[] = "*****"; //Replace stars with Wifi Password

double avered = 0; double aveir = 0;
double sumirrms = 0;
double sumredrms = 0;
int i = 0;
int Num = 100;//calculate SpO2 by this sampling interval

double ESpO2 = 95.0;//initial value of estimated SpO2
double FSpO2 = 0.7; //filter factor for estimated SpO2
double frate = 0.95; //low pass filter for IR/red LED value to eliminate AC component
#define TIMETOBOOT 3000 // wait for this time(msec) to output SpO2
#define SCALE 88.0 //adjust to display heart beat and SpO2 in the same scale
#define SAMPLING 5 //if you want to see heart beat more precisely , set SAMPLING to 1
#define FINGER_ON 30000 // if red signal is lower than this , it indicates your finger is not on the sensor
#define MINIMUM_SPO2 80.0

const byte RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred
float beatsPerMinute;
int beatAvg;


#define USEFIFO
void setup() {
  {
    delay (200) ;
    Serial.begin(115200);
    while (!Serial) ;
    delay (200) ;
    Serial.println("Initializing...");

    Blynk.begin(auth, ssid, pass);

    // Initialize sensor
    while (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
    {
      Serial.println("MAX30102 was not found. Please check wiring/power/solder jumper at MH-ET LIVE MAX30102 board. ");
      //while (1);
    }

    //Setup to sense a nice looking saw tooth on the plotter
    byte ledBrightness = 0x7F; //Options: 0=Off to 255=50mA
    byte sampleAverage = 4; //Options: 1, 2, 4, 8, 16, 32
    byte ledMode = 2; //Options: 1 = Red only, ET LIVE MAX30102 board
    int sampleRate = 200; //Options: 50, 100, 200, 400, 800, 1000, 1600, 3200
    int pulseWidth = 411; //Options: 69, 118, 215, 411
    int adcRange = 16384; //Options: 2048, 42 = Red + IR, 3 = Red + IR + Green
    //Options: 1 = IR only, 2 = Red + IR on MH-096, 8192, 16384
    // Set up the wanted parameters
    particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); //Configure sensor with these settings

    particleSensor.enableDIETEMPRDY();
  }
}
void loop()
{
  uint32_t ir, red , green;
  double fred, fir;
  double SpO2 = 0; //raw SpO2 before low pass filtered
}
#ifdef USEFIFO
particleSensor.check(); //Check the sensor, read up to 3 samples

while (particleSensor.available()) {//do we have new data
#ifdef MAX30105
  red = particleSensor.getFIFORed(); //Sparkfun's MAX30105
  ir = particleSensor.getFIFOIR();  //Sparkfun's MAX30105
#else
  red = particleSensor.getFIFOIR(); //why getFOFOIR output Red data by MAX30102 on MH-ET LIVE breakout board
  ir = particleSensor.getFIFORed(); //why getFIFORed output IR data by MAX30102 on MH-ET LIVE breakout board
#endif



  i++;
  fred = (double)red;
  fir = (double)ir;
  avered = avered * frate + (double)red * (1.0 - frate);//average red level by low pass filter
  aveir = aveir * frate + (double)ir * (1.0 - frate); //average IR level by low pass filter
  sumredrms += (fred - avered) * (fred - avered); //square sum of alternate component of red level
  sumirrms += (fir - aveir) * (fir - aveir);//square sum of alternate component of IR level
  if ((i % SAMPLING) == 0) {//slow down graph plotting speed for arduino Serial plotter by thin out
    if ( millis() > TIMETOBOOT) {
      float ir_forGraph = (2.0 * fir - aveir) / aveir * SCALE;
      float red_forGraph = (2.0 * fred - avered) / avered * SCALE;
      //trancation for Serial plotter's autoscaling
      if ( ir_forGraph > 100.0) ir_forGraph = 100.0;
      if ( ir_forGraph < 80.0) ir_forGraph = 80.0;
      if ( red_forGraph > 100.0 ) red_forGraph = 100.0;
      if ( red_forGraph < 80.0 ) red_forGraph = 80.0;
      //        Serial.print(red); Serial.print(","); Serial.print(ir);Serial.print(".");
      if (ir < FINGER_ON) ESpO2 = MINIMUM_SPO2; //indicator for finger detached
      float temperature = particleSensor.readTemperatureF();
      Blynk.run();
      Blynk.virtualWrite(V4, ESpO2 );
      Serial.print(" Oxygen % = ");
      Serial.println(ESpO2);
    }
  }
  if ((i % Num) == 0) {
    double R = (sqrt(sumredrms) / avered) / (sqrt(sumirrms) / aveir);
    // Serial.println(R);
    SpO2 = -23.3 * (R - 0.4) + 100; //http://ww1.microchip.com/downloads/jp/AppNotes/00001525B_JP.pdf
    ESpO2 = FSpO2 * ESpO2 + (1.0 - FSpO2) * SpO2;//low pass filter
    //  Serial.print(SpO2);Serial.print(",");Serial.println(ESpO2);
    sumredrms = 0.0; sumirrms = 0.0; i = 0;
    break;
  }
  particleSensor.nextSample(); //We're finished with this sample so move to next sample
  //Serial.println(SpO2);
}
#endif
}
[/code]

Formates ton code avec ctrl t et tu verras qu'il y a un } en trop après cette ligne double SpO2 = 0; //raw SpO2 before low pass filtered

bonjours j'ai formaté le code et j'ai enlevé le } et sa a marché le code est opérationnelle.
maintenant sa me met un message d'erreurs de compilations pour la carte FireBeetle - Esp32
je mets ci - dessous les message d'erreurs ainsi que le programme

message d'erreurs

exit status 1
Erreur de compilation pour la carte FireBeetle-ESP32


programme

/*
  ## Hardware Connections (ESP32 Arduino):
  -VIN = 3.3V
  -GND = GND
  -SDA = 21 (or SDA)
  -SCL = 22 (or SCL)

*/
#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

#include <Wire.h>
#include "MAX30105.h" //sparkfun MAX3010X library
#include "heartRate.h"
MAX30105 particleSensor;

//#define MAX30105 //if you have Sparkfun's MAX30105 breakout board , try #define MAX30105

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "flavienallano@gmail.com"; // Token you received on your email, Replace with stars

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*****"; // Replace stars with Wifi Name/SSID
char pass[] = "*****"; //Replace stars with Wifi Password

double avered = 0; double aveir = 0;
double sumirrms = 0;
double sumredrms = 0;
int i = 0;
int Num = 100;//calculate SpO2 by this sampling interval

double ESpO2 = 95.0;//initial value of estimated SpO2
double FSpO2 = 0.7; //filter factor for estimated SpO2
double frate = 0.95; //low pass filter for IR/red LED value to eliminate AC component
#define TIMETOBOOT 3000 // wait for this time(msec) to output SpO2
#define SCALE 88.0 //adjust to display heart beat and SpO2 in the same scale
#define SAMPLING 5 //if you want to see heart beat more precisely , set SAMPLING to 1
#define FINGER_ON 30000 // if red signal is lower than this , it indicates your finger is not on the sensor
#define MINIMUM_SPO2 80.0

const byte RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred
float beatsPerMinute;
int beatAvg;


#define USEFIFO
void setup() {
  {
    delay (200) ;
    Serial.begin(115200);
    while (!Serial) ;
    delay (200) ;
    Serial.println("Initializing...");

    Blynk.begin(auth, ssid, pass);

    // Initialize sensor
    while (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
    {
      Serial.println("MAX30102 was not found. Please check wiring/power/solder jumper at MH-ET LIVE MAX30102 board. ");
      //while (1);
    }

    //Setup to sense a nice looking saw tooth on the plotter
    byte ledBrightness = 0x7F; //Options: 0=Off to 255=50mA
    byte sampleAverage = 4; //Options: 1, 2, 4, 8, 16, 32
    byte ledMode = 2; //Options: 1 = Red only, ET LIVE MAX30102 board
    int sampleRate = 200; //Options: 50, 100, 200, 400, 800, 1000, 1600, 3200
    int pulseWidth = 411; //Options: 69, 118, 215, 411
    int adcRange = 16384; //Options: 2048, 42 = Red + IR, 3 = Red + IR + Green
    //Options: 1 = IR only, 2 = Red + IR on MH-096, 8192, 16384
    // Set up the wanted parameters
    particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); //Configure sensor with these settings

    particleSensor.enableDIETEMPRDY();
  }
}
void loop()
{
  uint32_t ir, red , green;
  double fred, fir;
  double SpO2 = 0; //raw SpO2 before low pass filtered

#ifdef USEFIFO
particleSensor.check(); //Check the sensor, read up to 3 samples

while (particleSensor.available()) {//do we have new data
#ifdef MAX30105
  red = particleSensor.getFIFORed(); //Sparkfun's MAX30105
  ir = particleSensor.getFIFOIR();  //Sparkfun's MAX30105
#else
  red = particleSensor.getFIFOIR(); //why getFOFOIR output Red data by MAX30102 on MH-ET LIVE breakout board
  ir = particleSensor.getFIFORed(); //why getFIFORed output IR data by MAX30102 on MH-ET LIVE breakout board
#endif



  i++;
  fred = (double)red;
  fir = (double)ir;
  avered = avered * frate + (double)red * (1.0 - frate);//average red level by low pass filter
  aveir = aveir * frate + (double)ir * (1.0 - frate); //average IR level by low pass filter
  sumredrms += (fred - avered) * (fred - avered); //square sum of alternate component of red level
  sumirrms += (fir - aveir) * (fir - aveir);//square sum of alternate component of IR level
  if ((i % SAMPLING) == 0) {//slow down graph plotting speed for arduino Serial plotter by thin out
    if ( millis() > TIMETOBOOT) {
      float ir_forGraph = (2.0 * fir - aveir) / aveir * SCALE;
      float red_forGraph = (2.0 * fred - avered) / avered * SCALE;
      //trancation for Serial plotter's autoscaling
      if ( ir_forGraph > 100.0) ir_forGraph = 100.0;
      if ( ir_forGraph < 80.0) ir_forGraph = 80.0;
      if ( red_forGraph > 100.0 ) red_forGraph = 100.0;
      if ( red_forGraph < 80.0 ) red_forGraph = 80.0;
      //        Serial.print(red); Serial.print(","); Serial.print(ir);Serial.print(".");
      if (ir < FINGER_ON) ESpO2 = MINIMUM_SPO2; //indicator for finger detached
      float temperature = particleSensor.readTemperatureF();
      Blynk.run();
      Blynk.virtualWrite(V4, ESpO2 );
      Serial.print(" Oxygen % = ");
      Serial.println(ESpO2);
    }
  }
  if ((i % Num) == 0) {
    double R = (sqrt(sumredrms) / avered) / (sqrt(sumirrms) / aveir);
    // Serial.println(R);
    SpO2 = -23.3 * (R - 0.4) + 100; //http://ww1.microchip.com/downloads/jp/AppNotes/00001525B_JP.pdf
    ESpO2 = FSpO2 * ESpO2 + (1.0 - FSpO2) * SpO2;//low pass filter
    //  Serial.print(SpO2);Serial.print(",");Serial.println(ESpO2);
    sumredrms = 0.0; sumirrms = 0.0; i = 0;
    break;
  }
  particleSensor.nextSample(); //We're finished with this sample so move to next sample
  //Serial.println(SpO2);
}
#endif
}

J'ai essayé de compiler ton code et il n'y a pas d'erreur de compilation