Arduino lab 1_1

Post on 14-May-2015

578 views 4 download

description

Variant of first lab. How to generate a visual distress signal (what is popularly known as SOS)

Transcript of Arduino lab 1_1

Arduino Lab 1.1LED Pattern - SOS

Pre-requisiteArduino Lab 1.0

Same material, installation

Understanding of - setup, - loop, - output, - delay- digitalWrite,pinMode- High, Low

Setup

Define Pin 13 as LED

Set it as Output

Use a variable I#define LED 13int I;void setup(){ pinMode(LED,OUTPUT);}

Loop

Blink led for 3 times. Each blink is for 100 msec

Blink led for 3 times. Each blink is for 300 msec now.

Remain in loop

This is SOS dot-dot-dot-dash-dash-dash-dot-dot-dot......

void loop(){ for(I=0;I<3;++I) { digitalWrite(LED,HIGH); delay(100); digitalWrite(LED,LOW); delay(100); } for(I=0;I<3;++I) { digitalWrite(LED,HIGH); delay(500); digitalWrite(LED,LOW); delay(500); }}

Loop

LogicWell, part of the program is same as first except that it is executed only for 3 times

and then it moves to next step which is same except that delay is more and again repeated for three times

And then back to previous step

Result is morse code for SOS

Query

You hear Morse code for SMS almost every day for last so many years.

Guess where?

Contact MeHave more ideas, queries, suggestions?

Contact me at -

Vinay Chaddha

email : vinay@open-embedded.info

SMS : 9811074026

know more about me at visualcv.com/gvc3065