-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmofiza.V1.c
62 lines (56 loc) · 906 Bytes
/
mofiza.V1.c
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
#include "ServoTimer2.h"
#include<SD.h>
#define SD_ChipSelectPin 10
#include"TMRpcm.h"
#include<SPI.h>
TMRpcm tmrpcm;
ServoTimer2 matha;
ServoTimer2 lhand;
ServoTimer2 rhand;
int in1= 6;
int in2= 7;
int in3= 8;
void setup()
{
matha.attach(2);
lhand.attach(3);
rhand.attach(4);
tmrpcm.speakerPin=9;
Serial.begin(9600);
if(!SD.begin(SD_ChipSelectPin))
{
Serial.println("SD FAIL");
return;
}
}
void loop()
{
if(!(digitalRead(in3)))
{
tmrpcm.play("welcome.wav");
lhand.write(2500);
delay(2000);
lhand.write(1200);
delay(9000);
}
if(!(digitalRead(in1)))
{
tmrpcm.play("bal.wav");
rhand.write(300);
matha.write(2000);
delay(3000);
}
if(!(digitalRead(in2)))
{
tmrpcm.play("bal.wav");
lhand.write(2000);
matha.write(1000);
delay(3000);
}
else
{
lhand.write(300);
rhand.write(1700);
matha.write(1500);
}
}