LED Blinky fun!

I was able to get an Arduino blinking with a 220 resitor. The initial sketch has a delay of of 1000 for the high and low digital write. I played with various settings changing the delay to 100 10 and a few other settings. I also was able to replace the 220 resisitor with a photo resistor with the value of a high at a constant rate. I was able to dim the light with moments of my hand blocking the photo resistor.20140206_140518

Part 4

I was able to get three blinking LEDs up for sequencial blinking. All that was needed was to create 3 variables, led1, led2 and led three and use the same code with varying delays to get this to work. Here is the code:

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led1 = 13;
int led2 = 12;
int led3 = 8;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led1, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(100);               // wait for a second
digitalWrite(led1, LOW);    // turn the LED off by making the voltage LOW
delay(100);               // wait for a second

digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(200);               // wait for a second
digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
delay(200);               // wait for a second

digitalWrite(led3, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(300);               // wait for a second
digitalWrite(led3, LOW);    // turn the LED off by making the voltage LOW
delay(300);               // wait for a second
}

20140206_161922

Part 5 SOS

Using 1 LED I was able to get a SOS up and running. Here is the code:

 

// This sketch will allow cause a led to do a SOS signal

int ledPin =  12;    // LED connected to digital pin 12

// The setup() method runs once, when the sketch starts

void setup()   {

pinMode(ledPin, OUTPUT);
}

void loop()
{
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(3000);                // 3 second delay wich acts 1: before loop to make sure your ready and 2: act as a delay for when it starts all over again 🙂
digitalWrite(ledPin, HIGH);   //”S” signal starts after the one second delay
delay(1000);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(3000);                  //3 second delay for the second letter (fisrt of 2)
digitalWrite(ledPin, HIGH);
delay(3000);                  // First dash of 3 wich represents the O
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(3000);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(3000);
digitalWrite(ledPin, LOW);
delay(3000);                  //second 3 second delay for the third letter
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);

}

 

I downloading the code from http://www.instructables.com/id/SOS-signal-with-an-arduino/

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s