-
Notifications
You must be signed in to change notification settings - Fork 1
/
ledlighting.ino
executable file
·74 lines (67 loc) · 1.12 KB
/
ledlighting.ino
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
62
63
64
65
66
67
68
69
70
71
72
73
74
int led1=5;
int led2=4;
int led3=3;
int led4=2;
int led5=1;
void setup() {
// put your setup code here, to run once:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
lightsOn(1);
lightsOn(2);
lightsOn(3);
lightsOn(4);
lightsOn(5);
}
void lightsOn(int ledno)
{
if( ledno==1)
{
digitalWrite(led1,HIGH);
}
else if( ledno==2)
{
digitalWrite(led2,HIGH);
}
else if( ledno==3)
{
digitalWrite(led3,HIGH);
}
else if( ledno==4)
{
digitalWrite(led4,HIGH);
}
else if( ledno==5)
{
digitalWrite(led5,HIGH);
}
}
void lightsOff(int ledno)
{
if( ledno==1)
{
digitalWrite(led1,LOW);
}
else if( ledno==2)
{
digitalWrite(led2,LOW);
}
else if( ledno==3)
{
digitalWrite(led3,LOW);
}
else if( ledno==4)
{
digitalWrite(led4,LOW);
}
else if( ledno==5)
{
digitalWrite(led5,LOW);
}
}