Arduino LED Matchstick

4.7K62

Intro: Arduino LED Matchstick

I saw https://www.instructables.com/id/Fire-free-LED-Matchstick/, but to my dismay it was only a video. So i had my Arduino and i thought I could do the same thing as it.  

STEP 1: Materials

List

-Arduino

-LED (if you have a onboard LED connected to pin thirteen, optional)

-Nine Volt (optional)

-Nine volt adapter (optional)

-USB cable

STEP 2: Power Methods

There are two ways to power the Arduino, USB or DC port. For this you can just use the USB Port

STEP 3: LED

If you decide to use a external led put the positive end in pin thirteen and the negative lead to ground.

STEP 4: The Code

int ledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()
{
digitalWrite(ledPin, HIGH);
delay(4000);
digitalWrite(ledPin, HIGH);
delay(30);
digitalWrite(ledPin, LOW);
delay(30);
digitalWrite(ledPin, HIGH);
delay(30);
digitalWrite(ledPin, LOW);
delay(30);
digitalWrite(ledPin, HIGH);
delay(35);
digitalWrite(ledPin, LOW);
delay(35);
digitalWrite(ledPin, HIGH);
delay(35);
digitalWrite(ledPin, LOW);
delay(35);
digitalWrite(ledPin, HIGH);
delay(35);
digitalWrite(ledPin, LOW);
delay(35);
digitalWrite(ledPin, HIGH);
delay(35);
digitalWrite(ledPin, LOW);
delay(35);
digitalWrite(ledPin, HIGH);
delay(35);
digitalWrite(ledPin, LOW);
delay(35);
digitalWrite(ledPin, HIGH);
delay(35);
digitalWrite(ledPin, LOW);
delay(35);
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(45);
digitalWrite(ledPin, HIGH);
delay(45);
digitalWrite(ledPin, LOW);
delay(45);
digitalWrite(ledPin, HIGH);
delay(45);
digitalWrite(ledPin, LOW);
delay(45);
digitalWrite(ledPin, HIGH);
delay(45);
digitalWrite(ledPin, LOW);
delay(45);
digitalWrite(ledPin, HIGH);
delay(45);
digitalWrite(ledPin, LOW);
delay(50);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, HIGH);
delay(55);
digitalWrite(ledPin, LOW);
delay(55);
digitalWrite(ledPin, HIGH);
delay(55);
digitalWrite(ledPin, LOW);
delay(55);
digitalWrite(ledPin, LOW);
delay(50000000);
}               

STEP 5: Video

this is my video

2 Comments

for making the code a LOT more simple you can use loops which would reduce your loop() function down to about 10-15 lines of code rather than like 50, and also why are you waiting 50,000,000 milliseconds at the end?
THX i am new to this and i wanted to loop it but i didn't know how to end the loop so i did a long pause at the end so i can hit the button "striking" the match