-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.ino
89 lines (70 loc) · 1.48 KB
/
demo.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
88
89
#include "Keyboard.h"
#define BUTTON1 2
#define LED1 3
#define BUTTON2 4
#define LED2 5
#define BUTTON3 7
#define LED3 6
#define BUTTON4 8
#define LED4 9
void setup() {
pinMode(BUTTON1, INPUT_PULLUP);
pinMode(LED1, OUTPUT);
pinMode(BUTTON2, INPUT_PULLUP);
pinMode(LED2, OUTPUT);
pinMode(BUTTON3, INPUT_PULLUP);
pinMode(LED3, OUTPUT);
pinMode(BUTTON4, INPUT_PULLUP);
pinMode(LED4, OUTPUT);
}
void loop() {
/*
Boton 1
Al leer LOW detecta que el boton esta presionado
*/
if (digitalRead(BUTTON1) == LOW) {
Keyboard.begin();
Keyboard.print("Boton 1");
Keyboard.releaseAll();
//enciende los leds por un instante
digitalWrite(LED1,HIGH);
delay(50);
digitalWrite(LED1,LOW);
}
/*
Boton 2
*/
if (digitalRead(BUTTON2) == LOW) {
Keyboard.begin();
Keyboard.print("Boton 2");
Keyboard.releaseAll();
//enciende los leds por un instante
digitalWrite(LED2,HIGH);
delay(50);
digitalWrite(LED2,LOW);
}
/*
Boton 3
*/
if (digitalRead(BUTTON3) == LOW) {
Keyboard.begin();
Keyboard.print("Boton 3");
Keyboard.releaseAll();
//enciende los leds por un instante
digitalWrite(LED3,HIGH);
delay(50);
digitalWrite(LED3,LOW);
}
/*
Boton 4
*/
if (digitalRead(BUTTON4) == LOW) {
Keyboard.begin();
Keyboard.print("Boton 4");
Keyboard.releaseAll();
//enciende los leds por un instante
digitalWrite(LED4,HIGH);
delay(50);
digitalWrite(LED4,LOW);
}
}