Ligne 322 : |
Ligne 322 : |
| | | |
| Pour plus d'information: | | Pour plus d'information: |
− | * Voir | + | * Voir http://mchobby.be/wiki/index.php?title=Photo-résistance (en FRANCAIS) |
− | * Voir htt://www.ladyada.net/learn/sensors/cds.html (en anglais) | + | * Voir htt://www.ladyada.net/learn/sensors/cds.html (en anglais) |
| | | |
| */ | | */ |
| | | |
− | int photocellPin = 0; // the cell and 10K pulldown are connected to a0 | + | int photocellPin = 0; // La photo-résistance et la résistance 10K connectées sur la pin/broche analogique A0 |
− | int photocellReading; // the analog reading from the analog resistor divider | + | int photocellReading; // Contient la lecture analogique sur le pont diviseur Photo-résistance + R 10 KOhms |
| | | |
| void setup(void) { | | void setup(void) { |
− | // We'll send debugging information via the Serial monitor | + | // Démarrons la connexion série pour envoyer des message de debugging. |
| Serial.begin(9600); | | Serial.begin(9600); |
| } | | } |
Ligne 338 : |
Ligne 338 : |
| photocellReading = analogRead(photocellPin); | | photocellReading = analogRead(photocellPin); |
| | | |
− | Serial.print("Analog reading = "); | + | Serial.print("Lecture Analogique = "); |
− | Serial.print(photocellReading); // the raw analog reading | + | Serial.print(photocellReading); // La valeur analogique brute |
| | | |
− | // We'll have a few threshholds, qualitatively determined | + | // Utilisons quelques seuils, détermination qualitative |
| if (photocellReading < 10) { | | if (photocellReading < 10) { |
− | Serial.println(" - Dark"); | + | Serial.println(" - Noir"); // Dark en anglais |
| } else if (photocellReading < 200) { | | } else if (photocellReading < 200) { |
− | Serial.println(" - Dim"); | + | Serial.println(" - Sombre"); // Dim en anglais (aussi traduit par Obscur) |
| } else if (photocellReading < 500) { | | } else if (photocellReading < 500) { |
− | Serial.println(" - Light"); | + | Serial.println(" - Léger"); // Light en anglais |
| } else if (photocellReading < 800) { | | } else if (photocellReading < 800) { |
− | Serial.println(" - Bright"); | + | Serial.println(" - Lumineux"); // Bright en anglais |
| } else { | | } else { |
− | Serial.println(" - Very bright"); | + | Serial.println(" - Très lumineux"); // Very bright en anglais |
| } | | } |
| delay(1000); | | delay(1000); |