Bonjour,
Sans doute une erreur stupide (que j'arrive à contourner) mais je voudrais comprendre pourquoi j'ai une erreur de compilation....
Voici le problème:
J'ai une constante appelée "length" déclarée avant mon void setup.
Dans mon void setup j'initialise un tableau appelé "fir1_Coeffs" qui comporte un nombre d'éléments égal à "length", ceci grâce à une boucle "For".
Lorsque l'index "i" de cette boucle For arrive à la valeur "length" je voudrais afficher "Serial.println("Length= ", length);", et là ça plante à la compilation (alors que le Serial.println qui précède immédiatement celui-ci passe sans problème)...
J'ai même déclaré "i" en global, mais rien n'y fait.
Pourtant on peut bien faire afficher la valeur d'un entier après une chaîne de caractère: je l'ai fait des millions de fois...
J'arrive à m'en passer, mais je ne comprends pas pourquoi ! vu que ça fait longtemps que je traîne ça, je finis par ne plus voir ma bêtise...
Voici le code:
et les messages d'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 const int length = 57; // définition de la longueur du filtre, i.e le nombre de coefficients // Liste des 57 coefficients bruts donnés par lesite arc.id.au de calcul des fltres float Coeffs_Bruts[] = { -0.000220, 0.000395, -0.000589, 0.000753, -0.000817, 0.000696, -0.000308, -0.000416, 0.001510, -0.002950, 0.004644, -0.006416, 0.008012, -0.009109, 0.009343, -0.008340, 0.005765, -0.001367, -0.004979, 0.013234, -0.023175, 0.034397, -0.046329, 0.058275, -0.069471, 0.079153, -0.086631, 0.091355, 0.907029, 0.091355, -0.086631, 0.079153, -0.069471, 0.058275, -0.046329, 0.034397, -0.023175, 0.013234, -0.004979, -0.001367, 0.005765, -0.008340, 0.009343, -0.009109, 0.008012, -0.006416, 0.004644, -0.002950, 0.001510, -0.000416, -0.000308, 0.000696, -0.000817, 0.000753, -0.000589, 0.000395, -0.000220}; // The declaration below seems similar to the "struct" declaration used in the Teensy FIR Filter example // but the "const" approach has been said to be more optimized than the éstruct" approach //remplacer "length" par 57 ne change rien: toujours le Warning à la compilation int short fir1_Coeffs[length]; // définition du tableau de constantes que l'on va calculer // à partir de la liste "Coeffs_Bruts" du dessus //const int myInput = AUDIO_INPUT_MIC; // removed from the Teensy FIR example const int myInput = AUDIO_INPUT_LINEIN; // because my correct input is not MIC // d'autres exemples utilisent myInput = AUDIO_INPUT_LINEIN; // avec un diagramme AudioDesignTool dans le domaine digital aussi // par ex le prog "Invert Phase Audio Signal" unsigned long last_time = millis(); // copied from the Teensy FIR example EXTMEM char bigBuffer[1000000]; // pour utiliser les 2 puces PSRAM additionnelles // bigBuffer pourra être renommé si besoin void setup() { Serial.begin(9600); //copied from the Teensy FIR Filter example delay(300); //copied from the Teensy FIR Filter example strcpy(bigBuffer, "Hello World"); // initialize the bigBuffer with // anything we may want //transfère les Coeffs_Bruts dans le tableau LPF_Coeffs, sous forme "short" for (int i=1 ; i<=length ; i++) { fir1_Coeffs[i] == (short) (32768 * Coeffs_Bruts[i]); // cette boucle if ne passe pas à la compilation, faudra demander pourquoi if (i == length){ Serial.println("Tableau fir1_Coeffs initialisé"); Serial.println("Length= ", length); } // } //fin du remplissage du tableau fir1_Coeffs
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84 sketch_FIR_009:132: error: no matching function for call to 'println(const char [9], const int&)' Serial.println("Length= ", length); ^ In file included from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:24:0, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/HardwareSerial.h:115, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:46, from C:\Users\Michel\AppData\Local\Temp\arduino_build_5467\pch\Arduino.h:6: E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:133:9: note: candidate: size_t Print::println(unsigned char, int) <near match> size_t println(unsigned char n, int base) { return print(n, base) + println(); } ^ E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:133:9: note: conversion of argument 1 would be ill-formed: \\DS1821\Datas\ELECTRONIQUE\TEENSY\Essais pgm\sketch_FIR_009\sketch_FIR_009.ino:132:37: warning: invalid conversion from 'const char*' to 'unsigned char' [-fpermissive] Serial.println("Length= ", length); ^ In file included from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:24:0, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/HardwareSerial.h:115, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:46, from C:\Users\Michel\AppData\Local\Temp\arduino_build_5467\pch\Arduino.h:6: E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:135:9: note: candidate: size_t Print::println(int, int) <near match> size_t println(int n, int base) { return print(n, base) + println(); } ^ E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:135:9: note: conversion of argument 1 would be ill-formed: \\DS1821\Datas\ELECTRONIQUE\TEENSY\Essais pgm\sketch_FIR_009\sketch_FIR_009.ino:132:37: warning: invalid conversion from 'const char*' to 'int' [-fpermissive] Serial.println("Length= ", length); ^ In file included from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:24:0, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/HardwareSerial.h:115, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:46, from C:\Users\Michel\AppData\Local\Temp\arduino_build_5467\pch\Arduino.h:6: E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:137:9: note: candidate: size_t Print::println(unsigned int, int) <near match> size_t println(unsigned int n, int base) { return print(n, base) + println(); } ^ E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:137:9: note: conversion of argument 1 would be ill-formed: \\DS1821\Datas\ELECTRONIQUE\TEENSY\Essais pgm\sketch_FIR_009\sketch_FIR_009.ino:132:37: warning: invalid conversion from 'const char*' to 'unsigned int' [-fpermissive] Serial.println("Length= ", length); ^ In file included from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:24:0, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/HardwareSerial.h:115, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:46, from C:\Users\Michel\AppData\Local\Temp\arduino_build_5467\pch\Arduino.h:6: E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:139:9: note: candidate: size_t Print::println(long int, int) <near match> size_t println(long n, int base) { return print(n, base) + println(); } ^ E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:139:9: note: conversion of argument 1 would be ill-formed: \\DS1821\Datas\ELECTRONIQUE\TEENSY\Essais pgm\sketch_FIR_009\sketch_FIR_009.ino:132:37: warning: invalid conversion from 'const char*' to 'long int' [-fpermissive] Serial.println("Length= ", length); ^ In file included from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:24:0, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/HardwareSerial.h:115, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:46, from C:\Users\Michel\AppData\Local\Temp\arduino_build_5467\pch\Arduino.h:6: E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:141:9: note: candidate: size_t Print::println(long unsigned int, int) <near match> size_t println(unsigned long n, int base) { return print(n, base) + println(); } ^ E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:141:9: note: conversion of argument 1 would be ill-formed: \\DS1821\Datas\ELECTRONIQUE\TEENSY\Essais pgm\sketch_FIR_009\sketch_FIR_009.ino:132:37: warning: invalid conversion from 'const char*' to 'long unsigned int' [-fpermissive] Serial.println("Length= ", length); ^ In file included from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:24:0, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/HardwareSerial.h:115, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:46, from C:\Users\Michel\AppData\Local\Temp\arduino_build_5467\pch\Arduino.h:6: E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:143:9: note: candidate: size_t Print::println(int64_t, int) <near match> size_t println(int64_t n, int base) { return print(n, base) + println(); } ^ E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:143:9: note: conversion of argument 1 would be ill-formed: \\DS1821\Datas\ELECTRONIQUE\TEENSY\Essais pgm\sketch_FIR_009\sketch_FIR_009.ino:132:37: warning: invalid conversion from 'const char*' to 'int64_t {aka long long int}' [-fpermissive] Serial.println("Length= ", length); ^ In file included from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:24:0, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/HardwareSerial.h:115, from E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:46, from C:\Users\Michel\AppData\Local\Temp\arduino_build_5467\pch\Arduino.h:6: E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:145:9: note: candidate: size_t Print::println(uint64_t, int) <near match> size_t println(uint64_t n, int base) { return print(n, base) + println(); } ^ E:\Programmes\Arduino\hardware\teensy\avr\cores\teensy4/Print.h:145:9: note: conversion of argument 1 would be ill-formed: \\DS1821\Datas\ELECTRONIQUE\TEENSY\Essais pgm\sketch_FIR_009\sketch_FIR_009.ino:132:37: warning: invalid conversion from 'const char*' to 'uint64_t {aka long long unsigned int}' [-fpermissive] Serial.println("Length= ", length); ^ Plusieurs bibliothèque trouvées pour "SD.h" Utilisé : E:\Programmes\Arduino\hardware\teensy\avr\libraries\SD Non utilisé : E:\Programmes\Arduino\libraries\SD
Partager