Bonjour,
Je rencontre un problème avec la compilation.
L'erreur rencontrée est la suivante : "a function-definition is not allowed here before '{' token", elle est assez fréquente d'après ce que j'ai pu voir sur internet. Elle intervient à la ligne suivante : "void reglagePositif(const int Vh, int d){".
const int switchPin1=2;
const int switchPin2=3;
const int switchPin3=4;
int switchState1 = 0;
int switchState2 = 0;
int switchState3 = 0;
const int entreePin = A0;
const int groundPin = A1;
int ledPin = 13;
const int Vb = 1;
const int Vh = 3;
void reglagePositif(const int Vh, int d);
void reglageNegatif(const int Vb, int d);
void flexion(void);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(switchPin1,INPUT_PULLUP);
pinMode(switchPin2,INPUT_PULLUP);
pinMode(switchPin3,INPUT_PULLUP);
pinMode(entreePin,OUTPUT);
pinMode(groundPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
while(switchState1 && switchState2 && switchState3){
switchState1 = digitalRead(2); //Vérification de la tension à la broche 2, 3 et 4
switchState2 = digitalRead(3);
switchState3 = digitalRead(4);
delay(100);
if(switchState1 == LOW && switchState2 == HIGH && switchState3 == HIGH){
void reglagePositif(const int Vh, int d){
digitalWrite(ledPin,HIGH);
analogWrite(entreePin,Vh*(255/5));
analogWrite(groundPin,0);
while(switchState1 == LOW){
switchState1 = digitalRead(2);
}
delay(500);
analogWrite(entreePin,0);
}
}
if(switchState2 == LOW && switchState1 == HIGH && switchState3 == HIGH){
void reglageNegatif(const int Vb, int d){
digitalWrite(ledPin,HIGH);
analogWrite(entreePin,0);
analogWrite(groundPin,(Vb*(255/5)));
while(switchState2 == LOW){
switchState2 = digitalRead(3);
}
delay(500);
analogWrite(groundPin,0);
}
}
if(switchState3 == LOW && switchState1 == HIGH && switchState2 == HIGH){
void reglagePositif(const int Vh, int d){}
delay(1000);
void reglageNegatif(const int Vb, int d){}
delay(1000);
void flexion(void){}
}
delay(5000);
}
}
J'ai ajouté un "else" après le premier "if" en respectant la syntaxe mais le problème est toujours présent au même endroit.
Si vous avez des suggestions sur ce problème,
Merci par avance.