Introduction: La Bougie

Une bougie s’allume avec une flamme et s’éteint avec deux doigts.
Nous avons simplement transféré ce procédé à une version électronique d’une bougie qui fonctionne avec une Led.

A candle is lit with a flame on and off with two fingers.
We just transferred this process to an electronic version of a candle that works with LED.

To make this recipe, you simply need:

- And led a resistance

- An LDR

- Conductors son

- An Arduino Uno

- 9V battery

- A pencil holder



int potar=A1;
int led=11;
int howBright;

int potarValue;
int potarValueMap;

void setup() {
pinMode(led, OUTPUT);
pinMode(potar, INPUT);
Serial.begin(9600);
}

void loop(){
//lit et map les valeurs du potentiomètre
potarValue=analogRead(potar);
potarValueMap=map(potar, 70, 1024, 0, 255);
//allume la led proportionnellement avec le potentiomètre
if (potarValue<750)
{
analogWrite(led,0); // action A
}
else if ((led,0) && (potarValue<650))
{
analogWrite(led,0); // action B
}
if (potarValue>800)
{
{
howBright = random(128,255); // Change brightness to something between 128 and 255
analogWrite(led, howBright); // Illuminate the LED with the brightness picked
delay(random(50,150)); // Makes LED seem to flicker when on for a random time
} // action A
}




//lit et affiche les valeurs dans le serial moniteur
Serial.print(« potarValue = « );
Serial.print(potarValue);
Serial.print(« \t »);
Serial.print(« potarValueMap = « );
Serial.println(potarValueMap);

delay(50);
}



Make It Glow Contest

Participated in the
Make It Glow Contest

Microcontroller Contest

Participated in the
Microcontroller Contest