Hello i keep looking for an error I have but I don't find where it came from the error is
Arduino : 1.8.1 (Windows 10), Carte : "Arduino MKRZERO"
Encoder_SD:150: error: two or more data types in declaration of 'loop'
void loop()
^
exit status 1
two or more data types in declaration of 'loop'
and here is the code
//======Librairies ==========================================================
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include "SHTSensor.h"
#include "MS5611.h"
#include "BNO055_support.h" //Contains the bridge code between the API and Arduino
#include <Adafruit_Sensor.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
#include <SparkFunMLX90614.h>
//======Déclaration des I/O =================================================
#define TFT_CS 7
#define TFT_DC 6
#define TFT_RST 5
#define TFT_BACKLIGHT 2 // Display backlight pin
#define BLACK 0x000
#define CLK 4 // Entrées d'encodeur rotatif
#define DT 3 // Entrées d'encodeur rotatif
#define SW 10 // Entrées d'encodeur rotatif
#define SEALEVELPRESSURE_HPA (1013.25) //Pression par rapport au salève
struct bno055_t myBNO;
struct bno055_euler myEulerData; //Structure to hold the Euler data
//============== Carte SD===================================
const int chipSelect = SS1; // Pin utilisé pour le MKRzero (28)
unsigned long lastTime = 0;
int loadDataCheck; //Checks if data needs to be loaded
File data;
//===================================================================
byte last_second;
char Time[] = "TIME:00:00:00";
char Date[] = "DATE:00/00/2000";
int currentStateCLK;
int lastStateCLK;
int counter = 0; //état initial du conteur
int mic = A0; // Connectez la sortie MEMS AUD Ă la broche Arduino A0
int micOut; // Variable pour conserver les valeurs analogiques du micro
String currentDir = "";
unsigned long delayTime;
//======Déclaration des Instances ===========================================
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_BME280 bme;;
SHTSensor sht;
MS5611 MS5611(0x77);
SFE_UBLOX_GNSS myGNSS;
IRTherm therm;
SHTSensor
// =====FONCTIONS PROTOTYPES=================================================
float LectureValeursAltimetre (); // erreur
//===========================================================================
void setup()
{
pinMode(TFT_BACKLIGHT, OUTPUT);
//===========================================================================
pinMode(CLK, INPUT); // Définir les broches de l'encodeur comme entrées
pinMode(DT, INPUT); // Définir les broches de l'encodeur comme entrées
pinMode(SW, INPUT_PULLUP); // Définir les broches de l'encodeur comme entrées
lastStateCLK = digitalRead(CLK); // Lire l'état initial de CLK
//=====Initialisation communication série a 9600 bits par seconde ===========
Serial.begin(115200); // Configurer le moniteur série
//=====================Initialisation de la carte SD==========================
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
while (1);
}
Serial.println("card initialized.");
File dataFile = SD.open("data.txt", FILE_WRITE);
// si le documet est disponible y écrire:
if (dataFile) {
dataFile.println("pose x,pose y,pose z");
dataFile.close();
}
delay(1000);
//============Initalisation du capteur BNO055============================
Wire.begin();
BNO_Init(&myBNO); //Assigning the structure to hold information about the device
//Configuration pour NDoF mode
bno055_set_operation_mode(OPERATION_MODE_NDOF);
//=====================================================================================
delay(1);
Serial.begin(115200);
//====Initialisation du GPS ==================================================
Wire.begin();
if (myGNSS.begin() == false) //si le capteur n'est pas actif
{
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
while (1);
}
myGNSS.setI2COutput(COM_TYPE_UBX);
//====Initialisation du IR ==================================================
if (therm.begin() == false) //Initialiser le capteur IR thermique
{
Serial.println("Qwiic IR thermometer did not acknowledge! Freezing!");
while(1);
}
Serial.println("Qwiic IR Thermometer did acknowledge.");
therm.setUnit(TEMP_C); //Réglez les unités de la bibliothèque sur Celsius
//TEMP_C pour Celsius
//TEMP_K pour Kelvin
//TEMP_F pour Farenheit
pinMode(LED_BUILTIN, OUTPUT); //Broche LED comme sortie
//====Initialisation du Capteur de Pression ==================================
unsigned status;
status = bme.begin();
//====Initialisation SHT85 ==================================================
delay(1000);
if (sht.init()) //si le capteur est actif
{
Serial.print("init(): success\n");
}
else //si il n'est pas actif
{
Serial.print("init(): failed\n");
}
sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM);
}
void loop()
{
currentStateCLK = digitalRead(CLK); // Lire l'état actuel de CLK
if (currentStateCLK != lastStateCLK && currentStateCLK == 1) // Si le dernier et l'état actuel de CLK sont différents, alors l'impulsion s'est produite. Réagissez à un seul changement d'état pour éviter un double comptage
{
if (digitalRead(DT) != currentStateCLK) // Si l'état DT est différent de l'état CLK alors l'encodeur tourne dans le sens antihoraire donc décrémenter
{
counter --;
currentDir = "CCW";
}
else // L'encodeur tourne dans le sens horaire donc incrémente
{
counter ++;
currentDir = "CW";
}
Serial.print("Direction: ");
Serial.print(currentDir);
Serial.print(" | Counter: ");
Serial.println(counter);
}
lastStateCLK = currentStateCLK; // Se souvenir du dernier état CLK
if (counter == 0) //si le conteur Ă la valeur 0
{
//écran d'acceuill
tft.setTextWrap(true);
tft.fillScreen(ST77XX_BLACK); //Permet l'actualisation de l'écran
delay(10);
tft.setCursor(0, 57);
tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(2);
tft.println("TOURNEZ");
tft.setCursor(0, 87);
tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(2);
tft.println("L'ENCODER");
delay(1000);
}
if (counter == 1) //si le conteur Ă la valeur 1
{
//affichage de la température au sol, decibel et qualité de l'air
micOut = analogRead(mic); // lit l'entrée sur la broche analogique 0 :
tft.setTextWrap(true);
tft.fillScreen(ST77XX_BLACK); //Permet l'actualisation de l'écran
delay(10);
tft.setCursor(15, 4);
tft.setTextColor(ST77XX_GREEN);
tft.setTextSize(2);
tft.println("TEMP SOL");
tft.setCursor(25, 57);
tft.setTextColor(ST77XX_ORANGE);
tft.setTextSize(2);
tft.println("DECIBEL");
tft.setCursor(36, 110);
tft.setTextColor(ST77XX_CYAN);
tft.setTextSize(2);
tft.println("AIR");
tft.drawFastHLine(0, 53, tft.width(), ST7735_BLUE);
tft.drawFastHLine(0, 106, tft.width(), ST7735_BLUE);
/////////////////////////////////////////////////////////////////
digitalWrite(LED_BUILTIN, HIGH);
if (therm.read()) // Appelez therm.read() pour lire les températures de l'objet et ambiante à partir du capteur. En cas de succès, read() renverra 1, en cas d'échec 0.
{
// Utilisez les fonctions object() et ambient() pour saisir l'objet et les températures ambiantes. Ce seront des flottants, calculés dans l'unité que vous avez définie avec setUnit().
tft.setCursor(35, 21);
tft.setTextColor(ST77XX_GREEN);
tft.setTextSize(2);
tft.print(String(therm.object(), 1)); //affichage de la température du sol
}
digitalWrite(LED_BUILTIN, LOW);
tft.setCursor(35, 85);
tft.setTextColor(ST77XX_ORANGE);
tft.setTextSize(2);
tft.print(micOut, 1); //affichage des décibels
tft.setCursor(35, 138);
tft.setTextColor(ST77XX_CYAN);
tft.setTextSize(2);
tft.print(bme.readPressure() / 100.0F); //affichage de la qualité de l'air
delay(1000);
}
if (counter == 2) //si le conteur Ă la valeur 2
{
//définition de variables pour l'affichage de la date, horloge et altitude
long sec = myGNSS.getSecond();
long mn = myGNSS.getMinute();
/////////////////////////////////////////////////////////////////
tft.setTextWrap(true);
tft.fillScreen(ST77XX_BLACK); //Permet l'actualisation de l'écran
delay(10);
tft.setCursor(40, 4);
tft.setTextColor(ST77XX_RED);
tft.setTextSize(2);
tft.println("DATE");
tft.setCursor(0, 21);
tft.setTextColor(ST77XX_RED);
tft.setTextSize(2);
tft.println(" / / ");
tft.setCursor(40, 57);
tft.setTextColor(ST77XX_MAGENTA);
tft.setTextSize(2);
tft.println("TIME");
tft.setCursor(16, 85);
tft.setTextColor(ST77XX_MAGENTA);
tft.setTextSize(2);
tft.println(" : : ");
tft.setCursor(16, 110);
tft.setTextColor(ST77XX_YELLOW);
tft.setTextSize(2);
tft.println("ALTITUDE");
tft.drawFastHLine(0, 53, tft.width(), ST7735_BLUE);
tft.drawFastHLine(0, 106, tft.width(), ST7735_BLUE);
/////////////////////////////////////////////////////////////////
tft.setCursor(25, 138);
tft.setTextColor(ST77XX_YELLOW);
tft.setTextSize(2);
tft.println(bme.readAltitude(SEALEVELPRESSURE_HPA)); //affichage de l'altitude
/////////////////////////////////////////////////////////////////
tft.setCursor(2, 21);
tft.setTextColor(ST77XX_RED);
tft.setTextSize(2);
tft.print(myGNSS.getDay()); //affichage du jour
tft.setCursor(37, 21);
tft.setTextColor(ST77XX_RED);
tft.setTextSize(2);
tft.print(myGNSS.getMonth()); //affichage du mois
tft.setCursor(72, 21);
tft.setTextColor(ST77XX_RED);
tft.setTextSize(2);
tft.print(myGNSS.getYear()); //affichage de l'année
tft.setCursor(17, 85);
tft.setTextColor(ST77XX_MAGENTA);
tft.setTextSize(2);
tft.print(myGNSS.getHour() + 1); //affichage de l'heure +1 car elle est en UTC (-1h par rapport Ă la suisse)
/////////////////////////////////////////////////////////////////
if (mn < 10) //si les minutes n'affichent pas encore 2 chiffres (1mn-9mn)
{
tft.setCursor(16, 85);
tft.println(" :0 : "); //on affiche un zéro avant le premier chiffre
tft.setCursor(64, 85);
tft.setTextColor(ST77XX_MAGENTA);
tft.setTextSize(2);
tft.print(mn); //affichage des minutes
}
else
{
tft.setCursor(51, 85);
tft.setTextColor(ST77XX_MAGENTA);
tft.setTextSize(2);
tft.print(mn); //affichage des minutes
}
/////////////////////////////////////////////////////////////////
if (sec < 10) //si les secondes n'affichent pas encore 2 chiffres (1sec-9sec)
{
tft.setCursor(16, 85);
tft.println(" : :0 "); //on affiche un zéro avant le premier chiffre
tft.setCursor(100, 85);
tft.setTextColor(ST77XX_MAGENTA);
tft.setTextSize(2);
tft.print(sec); //affichage des secondes
}
else
{
tft.setCursor(88, 85);
tft.setTextColor(ST77XX_MAGENTA);
tft.setTextSize(2);
tft.print(sec); //affichage des secondes
}
/////////////////////////////////////////////////////////////////
delay(100);
}
if (counter == 3) //si le conteur a la valeur 3
{
tft.setTextWrap(true);
tft.fillScreen(ST77XX_BLACK); //Permet l'actualisation de l'écran
delay(10);
tft.setCursor(15, 4);
tft.setTextColor(ST77XX_GREEN);
tft.setTextSize(2);
tft.println("HUMIDITE");
tft.setCursor(40, 57);
tft.setTextColor(ST77XX_ORANGE);
tft.setTextSize(2);
tft.println("TEMP");
tft.setCursor(16, 110);
tft.setTextColor(ST77XX_CYAN);
tft.setTextSize(2);
tft.println("PRESSION");
tft.drawFastHLine(0, 53, tft.width(), ST7735_BLUE);
tft.drawFastHLine(0, 106, tft.width(), ST7735_BLUE);
/////////////////////////////////////////////////////////////////
if (sht.readSample()) //si le capteur est actif (capte humidité et température de l'air)
{
tft.setCursor(35, 21);
tft.setTextColor(ST77XX_GREEN);
tft.setTextSize(2);
tft.print(sht.getHumidity(), 1); //affichage de l'humidité
delay(1);
tft.setCursor(35, 85);
tft.setTextColor(ST77XX_ORANGE);
tft.setTextSize(2);
tft.print(sht.getTemperature(), 1); //affichage de la température de l'air
}
tft.setCursor(35, 138);
tft.setTextColor(ST77XX_CYAN);
tft.setTextSize(2);
tft.print(bme.readPressure() / 100.0F); //affichage de la pression
delay(1000);
}
//===================== Interface du capteur de position=========================================
if (counter==4)
{
unsigned long currentTime=millis();
if ((millis() - lastTime) >= 100) //To stream at 10 Hz without using additional timers
{
lastTime = millis();
bno055_read_euler_hrp(&myEulerData); //Update les données d'euler dans la structure
String dataString = "";
dataString += String(float(myEulerData.p) / 16.00);
dataString += "; ";
dataString += String(float(myEulerData.h) / 16.00);
dataString += "; ";
dataString += String(float(myEulerData.r) / 16.00);
dataString += "; ";
Serial.println(" Axe x(Roll), y(Pitch), z(yaw): "); //écriture des trois axes
Serial.println(dataString);
File dataFile = SD.open("data.txt", FILE_WRITE); // ouvrir le document sur la carte SD
if(dataFile) {
dataFile.println(dataString);
dataFile.close();
// print to the Serial port too:
}
}
}
//=============================== Control du nombre d'interfaces===================================
if (counter >= 5) //permet de n'avoir que 5 interfaces
{
counter = 0;
}
if (counter <= 0) //permet de n'avoir que 5 interfaces
{
counter = 0;
}
delay(100);
}
//=================================================================================================
I keep looking in the void loop but I can't find anything if you have an idea please tell me

