bonjour j'ai un problème avec mes definitions:
a function-definition is not allowed here before '{' token,
ce code vise à lire une entrée analogique(a0,a1) interpréter la donnée,
en fonction de la valeur interprétrée activiter ou non un pin, à cet arduino est associé un shield relais utilisant les pin (4,5,6,7)
sachant que les différents programmes sont activer/choisie par des pins qui sont eux même mis à la valeur 1 par un autre arduino qui lui utilise un shield lcd pour selectioner les menus et ainsi activer les pin(0,1,2,3,8)
j'espere avoir été assez claire ^-^ si vous avez des questions n'hesitez pas !
#define tinput0 A0 /*sonde buse*/
#define tinput1 A1 /*sonde préchauffage*/
float tvoltage1;
float tvoltage2;
float temperature1;
float temperature2;
const int consigne1 = 210; /* consigne PLA*/
const int consigne2 = 200;
const int consigne3 = 190; /*consigne abs*/
const int consigne4 = 180;
const int MOTEURBR = 7;
const int MOTEUREX = 6;
const int RESISTANCE2 = 5 ;
const int RESISTANCE1 = 4 ;
void setup() {
Serial.begin(9600); // Demarrer la liaison serie avec le PC b
pinMode(A0, INPUT);
pinMode(A1,INPUT);
pinMode(MOTEURBR,OUTPUT);
pinMode(MOTEUREX,OUTPUT);
pinMode(RESISTANCE1,OUTPUT);
pinMode(RESISTANCE2,OUTPUT);
pinMode(0,INPUT); /*pin relié à l'arduino méga */
pinMode(1,INPUT);
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(8,INPUT);
}
void LectureTemp()
{
/* lecture temperature */
tvoltage1=analogRead(tinput0);
temperature1=((5/400)*tvoltage1);
tvoltage2=analogRead(tinput1);
temperature2=((5/400)*tvoltage2);
return (temperature2);
return (temperature1);
}
void PilotagePLA()
{
/* pilotage résistance */
{
if (temperature1 < consigne1)
digitalWrite(RESISTANCE1,HIGH);
else (temperature1 > consigne1)
;digitalWrite(RESISTANCE1,LOW);
if (temperature2 < consigne2)
digitalWrite(RESISTANCE2,HIGH);
else (temperature2 > consigne2)
;digitalWrite(RESISTANCE2,LOW);
delay(500);
}
void PilotageABS(){
/* pilotage résistance */
{
if (temperature1 < consigne3)
digitalWrite(RESISTANCE1,HIGH);
else (temperature1 > consigne3)
;digitalWrite(RESISTANCE1,LOW);
if (temperature2 < consigne4)
digitalWrite(RESISTANCE2,HIGH);
else (temperature2 > consigne4)
; digitalWrite(RESISTANCE2,LOW);
delay(500);
}
}
void loop() {
LectureTemp();
{
if (digitalRead(0)=HIGH){
digitalWrite(MOTEURBR,LOW);
digitalWrite(RESISTANCE1,LOW);
digitalWrite(RESISTANCE2,LOW);
digitalWrite(MOTEUREX,LOW);
}
if (digitalRead(1)=HIGH){
PilotagePLA();
}
if (digitalRead(2)=HIGH){
PilotagePLA();
}
if (digitalRead(3)=HIGH){
PilotageABS();
}
if (digitalRead(8)=HIGH){
PilotageABS();
}
}
delay(500);
}
je vous remercie de votre attention,
cordialement