Big Dome Box: Difference between revisions
Jump to navigation
Jump to search
| Line 18: | Line 18: | ||
Sketch for Arduino Leornado |
Sketch for Arduino Leornado |
||
<pre> |
<pre> |
||
| ⚫ | |||
| ⚫ | |||
boolean flag=false; |
boolean flag=false; |
||
void setup() { |
void setup() { |
||
pinMode(domeButton, |
pinMode(domeButton, INPUT_PULLUP); |
||
Keyboard.begin(); |
Keyboard.begin(); |
||
} |
} |
||
void loop() { |
void loop() { |
||
if (!flag && digitalRead(domeButton) == HIGH) { |
if (!flag && digitalRead(domeButton) == HIGH) { |
||
Keyboard. |
Keyboard.print(" "); |
||
delay(100); |
|||
Keyboard.releaseAll(); |
|||
flag=true; |
flag=true; |
||
} |
} |
||
if (flag && digitalRead(domeButton) == LOW) { |
if (flag && digitalRead(domeButton) == LOW) { |
||
delay(100); |
|||
Keyboard.releaseAll(); |
Keyboard.releaseAll(); |
||
flag=false; |
flag=false; |
||
Revision as of 11:16, 6 December 2013
Matériel
- Big Dome Push Button
- MDF 6 mm / Contreplaqué 6 mm
- Arduino Leonardo
Design
Logiciel
Emergency Logout
http://www.arduino.cc/en/Tutorial/KeyboardLogout
Spacebar for Presentation
Sketch for Arduino Leornado
const int domeButton = 12;
boolean flag=false;
void setup() {
pinMode(domeButton, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
if (!flag && digitalRead(domeButton) == HIGH) {
Keyboard.print(" ");
delay(100);
Keyboard.releaseAll();
flag=true;
}
if (flag && digitalRead(domeButton) == LOW) {
delay(100);
Keyboard.releaseAll();
flag=false;
}
}