Bonjour à tous,
En ce moment j'ai un réel problème. Pour mon projet de bac je dois faire tourner un servomoteur en fonction de l'intensité de la lumière. Donc j'ai une carte arduino UNO avec un motor shield aisnis qu'un light sensor et un petit serov moteur.
L'échéance étant la semaine prochaine, mon programme ne fonctionne toujours pas ![]()
J'aurai vraiment besoin d'aide s'il vous plait
voici le code que j'ai réalisé pour l'instant, seulement plein de messages d'erreurs s'affichent par la suite :
#include <Servo.h>
volatile int pos = 0
volatile int photocellPin = 0;
volatile int photocellReading;
void setup(void)
{
Servo Myservo ;
Serial.begin(9600);
Myservo.attach(8) ;
}
void loop(void)
{
photocell Reading = analogRead(photocellPin);
Serial.print(“Analog reading = ”);
Serial.print(photocellReading);
if (photocellReading < 10)
{
Serial.print(“ - Noir”);
Pos = 18 ;
Myservo.write(pos) ;
delay(25) ;
}
else if (photocellReading < 200)
{
Serial.print(“ - Tamisée”);
Pos = 54 ;
Myservo.write(pos) ;
delay(35) ;
}
else if (photocellReading < 500)
{
Serial.print(“ - Moyenne”);
Pos = 90 ;
Myservo.write(pos) ;
delay(45) ;
}
else if (photocellReading < 800)
{
Serial.print(“ - Lumineux”);
Pos = 126 ;
Myservo.write(pos) ;
delay(55) ;
}
else
{
Serial.print(“ – Très lumineux”);
Pos = 162 ;
Myservo.write(pos) ;
delay(65) ;
}
delay(1000);
}
Le message d'erreur principal étant : 'Moyenne' was not declared in this scope et plein d'autre non déclaré également