Bonjour,
J'ai un programme sur un capteur de luminosité et je doit le mettre dans un autre mais sur une seul ligne j'aurais donc besoin de votre aide. Je dois le rentrer dans la ligne suivante.
analogWrite(PWM_TXT1, 240); // Réglage de la luminisité
analogWrite(PWM_TXT2, 240);
Voici mon programme pour le capteur de luminosté :
int photocellPin = A0; // the cell and 10K pulldown are connected to a0
int photocellReading; // the analog reading from the sensor divider
int LEDpin = 9; // connect Red LED to pin 11 (PWM pin)
int LEDbrightness; //
void setup(void) {
// We'll send debugging information via the Serial monitor
Serial.begin(9600);
}
void loop(void) {
photocellReading = analogRead(photocellPin);
Serial.print("Analog reading = ");
Serial.println(photocellReading); // the raw analog reading
// LED gets brighter the darker it is at the sensor
// that means we have to -invert- the reading from 0-1023 back to 1023-0
photocellReading = 1023 - photocellReading;
//now we have to map 0-1023 to 0-255 since thats the range analogWrite uses
LEDbrightness = map(photocellReading, 0, 1023, 20, 255);
analogWrite(LEDpin, LEDbrightness);
delay(100);
}
Merci de votre aide