-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmorse-code-demo.ino
More file actions
64 lines (44 loc) · 963 Bytes
/
morse-code-demo.ino
File metadata and controls
64 lines (44 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
Morse Code Key:
dot = LED on for 100 ms, then LED off for 100 ms
dash = LED on for 300 ms, then LED off for 100 ms
End of Letter = LED off for 1000 ms
End of Word = LED off for 2000 ms
Challenge #1: Write morse code "AN"
Challenge #2: Write morse code "SOS"
Challenge #3: Write morse code for any 5-letter word
Challenge #4: Write a 3-letter morse code and see if a partner can read it.
*/
void setup() {
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
}
void loop() {
//- the word AN
//A - dot-dash
//dot
digitalWrite(7,HIGH);
delay(100);
digitalWrite(7,LOW);
delay(100);
//dash
digitalWrite(7,HIGH);
delay(300);
digitalWrite(7,LOW);
delay(100);
delay(1000);
//N - dash-dot
//dash
digitalWrite(7,HIGH);
delay(300);
digitalWrite(7,LOW);
delay(100);
//dot
digitalWrite(7,HIGH);
delay(100);
digitalWrite(7,LOW);
delay(100);
delay(1000);
//-end of the word
delay(2000);
}