Erreur Arduino
Fermé
maxpothier
Messages postés
37
Date d'inscription
samedi 21 juillet 2018
Statut
Membre
Dernière intervention
28 décembre 2019
-
Modifié le 21 oct. 2018 à 11:22
[Dal] Messages postés 6203 Date d'inscription mercredi 15 septembre 2004 Statut Contributeur Dernière intervention 29 janvier 2025 - 23 oct. 2018 à 10:19
[Dal] Messages postés 6203 Date d'inscription mercredi 15 septembre 2004 Statut Contributeur Dernière intervention 29 janvier 2025 - 23 oct. 2018 à 10:19
A voir également:
- Erreur Arduino
- Erreur 0x80070643 - Accueil - Windows
- Erreur 0x80070643 Windows 10 : comment résoudre le problème de la mise à jour KB5001716 - Accueil - Windows
- Erreur 1001 outlook - Accueil - Bureautique
- Code erreur f3500-32 ✓ - Forum Bbox Bouygues
- Erreur g030 - Forum Bbox Bouygues
4 réponses
NHenry
Messages postés
15194
Date d'inscription
vendredi 14 mars 2003
Statut
Modérateur
Dernière intervention
23 février 2025
353
21 oct. 2018 à 13:10
21 oct. 2018 à 13:10
Pour l'erreur d'assignement :
digitalRead(x + 21) = 1
Il faut doubler le = pour faire un test d'égalité.
Et pour l'autre erreur, je pense que tu peux retirer la ligne :
pins = {};
digitalRead(x + 21) = 1
Il faut doubler le = pour faire un test d'égalité.
Et pour l'autre erreur, je pense que tu peux retirer la ligne :
pins = {};
maxpothier
Messages postés
37
Date d'inscription
samedi 21 juillet 2018
Statut
Membre
Dernière intervention
28 décembre 2019
1
Modifié le 22 oct. 2018 à 20:01
Modifié le 22 oct. 2018 à 20:01
Merci beaucoup,
Le programme ne me fait plus d'erreurs. Le voici:
mais j'ai beau saisir ou non le code sur le DIP, la led incorporée reste allumée... Pour comprendre le problème, j'ai fait un petit ajout de deux lignes:
mais l'erreur des mille et une lignes s'affiche:
Le programme ne me fait plus d'erreurs. Le voici:
void setup(){ pinMode(22, INPUT_PULLUP); pinMode(23, INPUT_PULLUP); pinMode(24, INPUT_PULLUP); pinMode(25, INPUT_PULLUP); pinMode(26, INPUT_PULLUP); pinMode(27, INPUT_PULLUP); pinMode(28, INPUT_PULLUP); pinMode(29, INPUT_PULLUP); pinMode(30, INPUT_PULLUP); pinMode(31, INPUT_PULLUP); pinMode(13, OUTPUT); } int code[] = {0, 0, 1, 1, 0, 1, 0, 1, 1, 0}; int pins[10] = {}; void loop(){ delay(15); for (int x = 0; x++; x<11){ if (digitalRead(x + 21) == 1){ pins[x] = 0; }else{ pins[x] = 1; } } int codeBon = 1; for (int x = 0; x++; x<11){ if (code[x] != pins[x]){ codeBon = 0; } } if (codeBon == 1){ digitalWrite(13, HIGH); }else{ digitalWrite(13, LOW); } }
mais j'ai beau saisir ou non le code sur le DIP, la led incorporée reste allumée... Pour comprendre le problème, j'ai fait un petit ajout de deux lignes:
void setup(){ pinMode(22, INPUT_PULLUP); pinMode(23, INPUT_PULLUP); pinMode(24, INPUT_PULLUP); pinMode(25, INPUT_PULLUP); pinMode(26, INPUT_PULLUP); pinMode(27, INPUT_PULLUP); pinMode(28, INPUT_PULLUP); pinMode(29, INPUT_PULLUP); pinMode(30, INPUT_PULLUP); pinMode(31, INPUT_PULLUP); pinMode(13, OUTPUT); Serial.begin(9600);// Là } int code[] = {0, 0, 1, 1, 0, 1, 0, 1, 1, 0}; int pins[10] = {}; void loop(){ delay(15); for (int x = 0; x++; x<11){ if (digitalRead(x + 21) == 1){ pins[x] = 0; }else{ pins[x] = 1; } } Serial.println(pins);// et Là int codeBon = 1; for (int x = 0; x++; x<11){ if (code[x] != pins[x]){ codeBon = 0; } } if (codeBon == 1){ digitalWrite(13, HIGH); }else{ digitalWrite(13, LOW); } }
mais l'erreur des mille et une lignes s'affiche:
sketch_oct20a.ino: In function ‘void loop()’:
sketch_oct20a.ino:26:22: error: no matching function for call to ‘println(int [10])’
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:26:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:193,
from sketch_oct20a.ino:1:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:70:12: note: candidate: size_t Print::println(char) <near match>
size_t println(char);
^
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:70:12: note: conversion of argument 1 would be ill-formed:
sketch_oct20a.ino:26:22: error: invalid conversion from ‘int*’ to ‘char’ [-fpermissive]
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:26:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:193,
from sketch_oct20a.ino:1:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:71:12: note: candidate: size_t Print::println(unsigned char, int) <near match>
size_t println(unsigned char, int = DEC);
^
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:71:12: note: conversion of argument 1 would be ill-formed:
sketch_oct20a.ino:26:22: error: invalid conversion from ‘int*’ to ‘unsigned char’ [-fpermissive]
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:26:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:193,
from sketch_oct20a.ino:1:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:72:12: note: candidate: size_t Print::println(int, int) <near match>
size_t println(int, int = DEC);
^
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:72:12: note: conversion of argument 1 would be ill-formed:
sketch_oct20a.ino:26:22: error: invalid conversion from ‘int*’ to ‘int’ [-fpermissive]
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:26:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:193,
from sketch_oct20a.ino:1:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:73:12: note: candidate: size_t Print::println(unsigned int, int) <near match>
size_t println(unsigned int, int = DEC);
^
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:73:12: note: conversion of argument 1 would be ill-formed:
sketch_oct20a.ino:26:22: error: invalid conversion from ‘int*’ to ‘unsigned int’ [-fpermissive]
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:26:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:193,
from sketch_oct20a.ino:1:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:74:12: note: candidate: size_t Print::println(long int, int) <near match>
size_t println(long, int = DEC);
^
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:74:12: note: conversion of argument 1 would be ill-formed:
sketch_oct20a.ino:26:22: error: invalid conversion from ‘int*’ to ‘long int’ [-fpermissive]
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:26:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:193,
from sketch_oct20a.ino:1:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:75:12: note: candidate: size_t Print::println(long unsigned int, int) <near match>
size_t println(unsigned long, int = DEC);
^
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:75:12: note: conversion of argument 1 would be ill-formed:
sketch_oct20a.ino:26:22: error: invalid conversion from ‘int*’ to ‘long unsigned int’ [-fpermissive]
NHenry
Messages postés
15194
Date d'inscription
vendredi 14 mars 2003
Statut
Modérateur
Dernière intervention
23 février 2025
353
22 oct. 2018 à 21:41
22 oct. 2018 à 21:41
Le message est clair :
error: no matching function for call to ‘println(int [10])’
println n'accepte pas un int[] en paramètre.
error: no matching function for call to ‘println(int [10])’
println n'accepte pas un int[] en paramètre.
maxpothier
Messages postés
37
Date d'inscription
samedi 21 juillet 2018
Statut
Membre
Dernière intervention
28 décembre 2019
1
22 oct. 2018 à 20:02
22 oct. 2018 à 20:02
rien que de lire les 3 premières lignes de l'erreur, j'ai mal à la tête...
[Dal]
Messages postés
6203
Date d'inscription
mercredi 15 septembre 2004
Statut
Contributeur
Dernière intervention
29 janvier 2025
1 099
23 oct. 2018 à 10:19
23 oct. 2018 à 10:19
Tu ne peux pas passer un tableau d'entiers à println()
https://www.arduino.cc/reference/en/language/functions/communication/serial/println/
Sinon, les arguments de ta boucle for inversent le test de sortie et l'incrémentation
au lieu de :
Dal
https://www.arduino.cc/reference/en/language/functions/communication/serial/println/
Sinon, les arguments de ta boucle for inversent le test de sortie et l'incrémentation
au lieu de :
for (int x = 0; x++; x<11){essaye
for (int x = 0; x<11; x++){...
Dal
22 oct. 2018 à 12:13
pins = {};
Sauf si ce qu'il veut est de remettre à zéro le tableau à chaque itération de la boucle...
si tel est le cas, il peut le faire ainsi :
22 oct. 2018 à 18:57
Et en plus, je n'avais pas vu, mais :
if (code == pins)
renverra toujours faux, car cela compare les pointeurs et pas le contenu des tableaux.