Friday, January 27, 2012

Large Blinking LED (blue)


I spent yesterday working on ARDX CIRC-01, and creating my own variations.  My husband walked in and said, "I could do that same thing without the Arduino."

Well, of course he could.  He's a electronics maven.  He can design circuits in his sleep, while I'm just wrapping my head around getting an LED to blink.  And at this point I can only do that only by using the Arduino.  However, I know he didn't mean it in an unkind way.  So too, I hope that anyone who reads this, and is far beyond me in knowledge and skill looks at my beginners attempts kindly.  In fact, if you are knowledgeable things in things electronic, I hope reading this will bring you happy memories of your own learning experiences, and maybe a knowing laugh or two.

If you are like me and just learning, I hope that what knowledge I have, the knowledge I gain, or what I'm struggling to learn, gives you confidence in your own attempts to make stuff.  I plan to share it all, even when I fail miserably.

CIRC-01 all wired up

"Blink" sketch (program)
So what did I do with the Arduino last night?  I began by following the instructions for ARDX CIRC-01, Getting Started Large Blinking LED, exactly.   Because I had already uploaded the Blink program the other night, all I had to do was to power on the Arduino and it worked.  It is pretty difficult to screw up the breadboard wiring with the overlay, but I was so grateful no smoke appeared on this first attempt.

After I had enjoyed the large blinking LED for a while, I made a few minor modifications to the program as suggested in the ARDX instructions.  I changed the pin to 12.  I changed the off time to 500 instead of 1000.  Simple stuff, but it was fun to make a little change and see it show work.  Instant positive feedback always helps me to learn.

I also detached the USB and powered it from a 9V power supply I had bought for the purpose.  The Arduino can also be powered by a 9V battery, though I didn't have one handy last night.

The Large Blinking LED in action

I played around with CIRC-01 like this for a while, when I had the idea: What if I had an emergency and had to use my blinking LED to signal an SOS?  So I took the Blink Program and made some very simple modifications.

I had to look up Morse Code to make sure that I got the timing right. The Morse Code is based on units of time.  A dot is 1 unit.  A dash is 3 units.  The gap between dots and dashes is 1 unit. The gap between letters is 3 units.  Finally, the space between words is 7 units.

I made my unit 300, or in the case of Arduino programming, that equals 300 milliseconds.  You can program this sketch yourself, but if you want to use this very simple modification I made to Blink, feel free to cut and paste. Using the CIRC-01 experiment, you too can make your own Arduino blinking LED SOS signal, because you never know when you will have an emergency.



/* SOS Blink
 * Turns on an LED on and off to signal an SOS in
 * Morse Code repeatedly.
 * based on Blink
 * 1 June 2005 By David Cuartielles
 * http://arduino.cc/en/Tutorial/Blink
 * based on an orginal by H. Barragan for the Wiring i/o board
 * modified from Blink 26 Jan 2012 by Gail Allinson 
 * do not use in demonstration situation where SOS blinking 
 * could be confused with a real emergency situation.
 */
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); // set the LED on
  delay(300); // begin S dot
  digitalWrite(ledPin, LOW); // set the LED off
  delay(300); // gap
  digitalWrite(ledPin, HIGH); // set the LED on
  delay(300); // dot
  digitalWrite(ledPin, LOW); // set the LED off
  delay(300); // gap
  digitalWrite(ledPin, HIGH); // set the LED on
  delay(300); // dot
  digitalWrite(ledPin, LOW); // set the LED off
  delay(900); // gap between letter
  digitalWrite(ledPin, HIGH); // set the LED on
  delay(900); // begin O dash
  digitalWrite(ledPin, LOW); // set the LED off
  delay(300); // gap
  digitalWrite(ledPin, HIGH); // set the LED on
  delay(900); // dash
  digitalWrite(ledPin, LOW); // set the LED off
  delay(300); // gap
  digitalWrite(ledPin, HIGH); // set the LED on
  delay(900); // dash
  digitalWrite(ledPin, LOW); // set the LED off
  delay(900); // gap between letter
  digitalWrite(ledPin, HIGH); // set the LED on
  delay(300); // begin S dot
  digitalWrite(ledPin, LOW); // set the LED off
  delay(300); // gap
  digitalWrite(ledPin, HIGH); // set the LED on
  delay(300); // dot
  digitalWrite(ledPin, LOW); // set the LED off
  delay(300); // gap
  digitalWrite(ledPin, HIGH); // set the LED on
  delay(300); // dot
  digitalWrite(ledPin, LOW); // set the LED off
  delay(2100); // gap between word
}

No comments:

Post a Comment

All comments are moderated.