-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKeyboardArduino.cpp
53 lines (48 loc) · 986 Bytes
/
KeyboardArduino.cpp
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
#include "KeyboardArduino.hpp"
////////////////////////////////////////////
//// VERIFICATION DE L'ETAT DES TOUCHES ////
////////////////////////////////////////////
bool pressUp()
{
int upVal = digitalRead(upPin); // Valeur à HIGH quand il est pas touche
if (upVal == LOW) {
//Serial.print("UP"); Pour Debug
return true;
}
else {
return false;
}
}
bool pressDown()
{
int downVal = digitalRead(downPin); // Valeur à HIGH quand il est pas touche
if (downVal == LOW) {
//Serial.print("DOWN"); Pour Debug
return true;
}
else {
return false;
}
}
bool pressLeft()
{
int leftVal = digitalRead(leftPin); // Valeur à HIGH quand il est pas touche
if (leftVal == LOW) {
//Serial.print("LEFT"); Pour Debug
return true;
}
else {
return false;
}
}
bool pressRight()
{
int rightVal = digitalRead(rightPin); // Valeur à HIGH quand il est pas touche
if (rightVal == LOW) {
//Serial.print("RIGHT"); Pour Debug
return true;
}
else {
return false;
}
}