Big Dome Box: Difference between revisions
Jump to navigation
Jump to search
| Line 15: | Line 15: | ||
http://www.arduino.cc/en/Tutorial/KeyboardLogout |
http://www.arduino.cc/en/Tutorial/KeyboardLogout |
||
===Spacebar for Presentation=== |
|||
Sketch for Arduino Leornado |
|||
<pre> |
|||
const int domeButton = 12; |
const int domeButton = 12; |
||
const int domeLed = 13; |
|||
boolean flag=false; |
boolean flag=false; |
||
void setup() { |
void setup() { |
||
pinMode(domeLed, OUTPUT); |
|||
pinMode(domeButton, INPUT_PULLUP); |
pinMode(domeButton, INPUT_PULLUP); |
||
Keyboard.begin(); |
Keyboard.begin(); |
||
| Line 29: | Line 28: | ||
if (!flag && digitalRead(domeButton) == HIGH) { |
if (!flag && digitalRead(domeButton) == HIGH) { |
||
digitalWrite(domeLed, HIGH); |
|||
Keyboard.print(" "); |
Keyboard.print(" "); |
||
delay(100); |
delay(100); |
||
| Line 35: | Line 35: | ||
} |
} |
||
if (flag && digitalRead(domeButton) == LOW) { |
if (flag && digitalRead(domeButton) == LOW) { |
||
digitalWrite(domeLed, LOW); |
|||
delay(100); |
delay(100); |
||
Keyboard.releaseAll(); |
Keyboard.releaseAll(); |
||
| Line 40: | Line 41: | ||
} |
} |
||
} |
} |
||
</pre> |
|||
Revision as of 14:10, 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
const int domeButton = 12; const int domeLed = 13; boolean flag=false;
void setup() {
pinMode(domeLed, OUTPUT); pinMode(domeButton, INPUT_PULLUP); Keyboard.begin();
}
void loop() {
if (!flag && digitalRead(domeButton) == HIGH) {
digitalWrite(domeLed, HIGH);
Keyboard.print(" ");
delay(100);
Keyboard.releaseAll();
flag=true;
}
if (flag && digitalRead(domeButton) == LOW) {
digitalWrite(domeLed, LOW);
delay(100);
Keyboard.releaseAll();
flag=false;
}
}