-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharduinazo.ino
87 lines (67 loc) · 1.25 KB
/
arduinazo.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
75
76
77
78
79
80
81
82
83
84
85
86
87
//Motor 1
int ENA = 8;
int IN1 = 2;
int IN2 = 3;
//Motor 2
int ENB = 9;
int IN3 = 4;
int IN4 = 5;
//Motor 3
int ENC = 10;
int IN5 = 6;
int IN6 = 7;
void setup()
{
pinMode (ENA, OUTPUT);
pinMode (ENB, OUTPUT);
pinMode (ENC, OUTPUT);
pinMode (IN1, OUTPUT);
pinMode (IN2, OUTPUT);
pinMode (IN3, OUTPUT);
pinMode (IN4, OUTPUT);
pinMode (IN5, OUTPUT);
pinMode (IN6, OUTPUT) ;
}
void Tensar ()
{
digitalWrite (IN1, HIGH);
digitalWrite (IN2,LOW);
analogWrite (ENA, 80);
digitalWrite (IN3, HIGH);
digitalWrite (IN4,LOW);
analogWrite (ENB, 80);
digitalWrite (IN5, HIGH);
digitalWrite (IN6,LOW);
analogWrite (ENC, 80);
}
void Destensar ()
{
digitalWrite (IN1, LOW);
digitalWrite (IN2,HIGH);
analogWrite (ENA, 80);
digitalWrite (IN3, LOW);
digitalWrite (IN4,HIGH);
analogWrite (ENB, 80);
digitalWrite (IN5, LOW);
digitalWrite (IN6,HIGH);
analogWrite (ENC, 80);
}
void Parar ()
{
digitalWrite (IN1, LOW);
digitalWrite (IN2,LOW);
analogWrite (ENA, 0);
digitalWrite (IN3, LOW);
digitalWrite (IN4,LOW);
analogWrite (ENB, 0);
digitalWrite (IN5, LOW);
digitalWrite (IN6,LOW);
analogWrite (ENC, 0);
}
void loop()
{
Tensar();
delay (2500);
Destensar();
delay(2500);
}