-
Notifications
You must be signed in to change notification settings - Fork 1
/
maszk.ino
43 lines (39 loc) · 958 Bytes
/
maszk.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
char val;
int relay = 13;
int green = 3;
int red = 2;
int buzzer = 5;
void setup()
{
Serial.begin(9600);
pinMode(relay, OUTPUT);
pinMode(green, OUTPUT);
pinMode(red, OUTPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
if(Serial.available() > 0) {
val = Serial.read();
switch (val)
{
case '2':
digitalWrite(relay, LOW);
digitalWrite(green, LOW);
digitalWrite(red, LOW);
noTone(buzzer);
break;
case '1':
digitalWrite(relay, HIGH);
digitalWrite(green, HIGH);
digitalWrite(red, LOW);
noTone(buzzer);
break;
case '0':
digitalWrite(relay, LOW);
digitalWrite(red, HIGH);
digitalWrite(green, LOW);
tone(buzzer,1000);
break;
}
}
}