Hello, my program aims to measure the temperature with the arduino board. Except that, my program displays an error. Here is my program :
#include<Wire.h>
#include<rgb_lcd.h>
#include<DHT.h>
rgb_lcdlcd;
DHT dht(A0, DHT22);
byte DEGREE_SYMBOL = 0;
bytedegree[8] = {
0b00000,
0b00010,
0b00101,
0b00010,
0b00000,
0b00000,
0b00000,
0b00000
};
voidsetup(){
Serial.begin(9600); // Initialiser la connexion sérielle
lcd.begin(16, 2); // Initialiser l’écran - 2 lignes avec 16 caractères chacune
lcd.createChar(DEGREE_SYMBOL, degree); // Enregistrer le nouveau symbole "°" à l’écran
dht.begin(); // Initialiser le capteur
}
voidloop() {
floathumidity = dht.readHumidity();
floattemperature = dht.readTemperature();
if (isnan(temperature) || isnan(humidity)) {
Serial.println(« Erreur à la lecture du capteur);
} else {
constfloatcoldest = 18;
constfloat hottest = 30;
intred = limit(255 * (temperature - coldest) / (hottest - coldest));
// Couleurs du bleu au rouge en passant par le violet
intgreen = 0;
// rouge et bleu plus on se rapproche des limites, blanc au milieu
// intgreen = limite(255 * sqrt(max(0, (–température la plus chaude)*(température la plus froide))) / (–la plus froide – la plus chaude));
intblue = limite(255 * (–température la plus chaude) / (–la plus froide – la plus chaude));
lcd.setRGB(rouge, vert, bleu);
lcd.setCursor(0, 0);
lcd.print("T: ");
lcd.print(temperature);
lcd.write(DEGREE_SYMBOL);
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("H: ");
lcd.print(humidity);
lcd.print("%");
}
delay(100);
}
floatlimit(floatcolor) { // Les valeurs de couleur doivent se situer dans la zone 0..255
if (color< 0) {
return 0;
}
elseif (color> 255) {
return 255;
}
else {
returncolor;
}
}
And here is the error message that appears :
Arduino : 1.8.1 (Windows 7), Carte : "Arduino/Genuino Uno"
forum:33: error: stray '\302' in program
Serial.println(« Erreur à la lecture du capteur);
^
forum:33: error: stray '\253' in program
forum:33: error: stray '\303' in program
forum:33: error: stray '\240' in program
forum:42: error: stray '\342' in program
intblue = limite(255 * (–température la plus chaude) / (–la plus froide – la plus chaude));
^
forum:42: error: stray '\200' in program
forum:42: error: stray '\223' in program
forum:42: error: stray '\303' in program
forum:42: error: stray '\251' in program
forum:42: error: stray '\342' in program
forum:42: error: stray '\200' in program
forum:42: error: stray '\223' in program
forum:42: error: stray '\342' in program
forum:42: error: stray '\200' in program
forum:42: error: stray '\223' in program
forum:5: error: 'rgb_lcdlcd' does not name a type
rgb_lcdlcd;
^
forum:9: error: 'bytedegree' does not name a type
bytedegree[8] = {
^
forum:20: error: expected constructor, destructor, or type conversion before ';' token
voidsetup(){
^
forum:28: error: expected constructor, destructor, or type conversion before ';' token
voidloop() {
^
forum:59: error: expected constructor, destructor, or type conversion before '(' token
floatlimit(floatcolor) { // Les valeurs de couleur doivent se situer dans la zone 0..255
^
C:\Users\yginoux\Desktop\plante_connect_\FORUM 6\forum\forum.ino:20:11: warning: ISO C++ forbids declaration of 'voidsetup' with no type [-fpermissive]
voidsetup(){
^
C:\Users\yginoux\Desktop\plante_connect_\FORUM 6\forum\forum.ino: In function 'int voidsetup()':
forum:22: error: 'lcd' was not declared in this scope
lcd.begin(16, 2); // Initialiser l’écran - 2 lignes avec 16 caractères chacune
^
forum:23: error: 'degree' was not declared in this scope
lcd.createChar(DEGREE_SYMBOL, degree); // Enregistrer le nouveau symbole "°" à l’écran
^
C:\Users\yginoux\Desktop\plante_connect_\FORUM 6\forum\forum.ino: At global scope:
C:\Users\yginoux\Desktop\plante_connect_\FORUM 6\forum\forum.ino:28:10: warning: ISO C++ forbids declaration of 'voidloop' with no type [-fpermissive]
voidloop() {
^
C:\Users\yginoux\Desktop\plante_connect_\FORUM 6\forum\forum.ino: In function 'int voidloop()':
forum:29: error: 'floathumidity' was not declared in this scope
floathumidity = dht.readHumidity();
^
forum:30: error: 'floattemperature' was not declared in this scope
floattemperature = dht.readTemperature();
^
forum:32: error: 'temperature' was not declared in this scope
if (isnan(temperature) || isnan(humidity)) {
^
forum:32: error: 'humidity' was not declared in this scope
if (isnan(temperature) || isnan(humidity)) {
^
forum:33: error: 'Erreur' was not declared in this scope
Serial.println(« Erreur à la lecture du capteur);
^
forum:35: error: 'constfloatcoldest' was not declared in this scope
constfloatcoldest = 18;
^
forum:36: error: 'constfloat' was not declared in this scope
constfloat hottest = 30;
^
forum:37: error: 'intred' was not declared in this scope
intred = limit(255 * (temperature - coldest) / (hottest - coldest));
^
forum:37: error: 'coldest' was not declared in this scope
intred = limit(255 * (temperature - coldest) / (hottest - coldest));
^
forum:37: error: 'hottest' was not declared in this scope
intred = limit(255 * (temperature - coldest) / (hottest - coldest));
^
forum:37: error: 'limit' was not declared in this scope
intred = limit(255 * (temperature - coldest) / (hottest - coldest));
^
forum:39: error: 'intgreen' was not declared in this scope
intgreen = 0;
^
forum:42: error: 'intblue' was not declared in this scope
intblue = limite(255 * (–température la plus chaude) / (–la plus froide – la plus chaude));
^
forum:42: error: 'temp' was not declared in this scope
intblue = limite(255 * (–température la plus chaude) / (–la plus froide – la plus chaude));
^
forum:42: error: expected ')' before 'rature'
intblue = limite(255 * (–température la plus chaude) / (–la plus froide – la plus chaude));
^
forum:43: error: 'lcd' was not declared in this scope
lcd.setRGB(rouge, vert, bleu);
^
forum:43: error: 'rouge' was not declared in this scope
lcd.setRGB(rouge, vert, bleu);
^
forum:43: error: 'vert' was not declared in this scope
lcd.setRGB(rouge, vert, bleu);
^
forum:43: error: 'bleu' was not declared in this scope
lcd.setRGB(rouge, vert, bleu);
^
C:\Users\yginoux\Desktop\plante_connect_\FORUM 6\forum\forum.ino: At global scope:
forum:59: error: expected constructor, destructor, or type conversion before '(' token
floatlimit(floatcolor) { // Les valeurs de couleur doivent se situer dans la zone 0..255
^
Plusieurs bibliothèque trouvées pour "DHT.h"
Utilisé : C:\Users\yginoux\Documents\Arduino\libraries\DHT_sensor_library-1.4.3
Non utilisé : C:\Users\yginoux\Documents\Arduino\libraries\Grove_Temperature_And_Humidity_Sensor-master
Plusieurs bibliothèque trouvées pour "rgb_lcd.h"
Utilisé : C:\Users\yginoux\Documents\Arduino\libraries\Grove___LCD_RGB_Backlight-1.0.0
Non utilisé : C:\Users\yginoux\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master
Non utilisé : C:\Users\yginoux\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master
Non utilisé : C:\Users\yginoux\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master
Non utilisé : C:\Users\yginoux\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master
exit status 1
stray '\302' in program
Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.
While searching on the internet, I saw that things had to be installed in the library. However, after installing a lot of stuff, I still have the same issues. If you have any solutions for me, thank you.