Arduino LED Matchstick

4,444

5

2

Introduction: Arduino LED Matchstick

About: I am interested in computer programming and robotics engineering. I am a true nerd.

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.  

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

Participated in the
USB Contest

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020

    2 Discussions

    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?

    0
    D5quar3
    D5quar3

    Reply 9 years ago on Introduction

    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