Big Dome Box: Difference between revisions

From air
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 4: Line 4:
==Matériel==
==Matériel==
* [[Big Dome Push Button]]
* [[Big Dome Push Button]]
* [[MDF]] 6 mm / [[Contreplaqué]] 6 mm
* [[MDF]] 5 mm / [[Contreplaqué]] 5 mm
* [[Arduino]] Leonardo
* [[Arduino]] Leonardo


Line 14: Line 14:
===Emergency Logout===
===Emergency Logout===
http://www.arduino.cc/en/Tutorial/KeyboardLogout
http://www.arduino.cc/en/Tutorial/KeyboardLogout
===Spacebar for presentation, movie pause&resume, ...===
<source lang="cpp">
const int domeButton = 12;
const int domeLed = 13;
boolean flag=false;
void setup() {
pinMode(domeLed, OUTPUT);
pinMode(domeButton, INPUT_PULLUP);
Keyboard.begin();
}


void loop() {
===Spacebar for Presentation===
Sketch for Arduino Leornado
if (!flag && digitalRead(domeButton) == HIGH) {
<pre>
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;
}
}
</source>


===for [[Reveal.js]]===
</pre>

* http://arduino.cc/en/Reference/KeyboardPress
* http://arduino.cc/en/Reference/KeyboardModifiers


<source lang="cpp">

const int domeButton = 12;
const int domeLed = 13;
boolean flag=false;
unsigned long time;

void setup() {
pinMode(domeLed, OUTPUT);
pinMode(domeButton, INPUT_PULLUP);
Keyboard.begin();
}

void loop() {
if (!flag && digitalRead(domeButton) == HIGH) {
digitalWrite(domeLed, HIGH);
time = millis();
delay(100);
Keyboard.releaseAll();
flag=true;
}
if (flag && digitalRead(domeButton) == LOW) {
digitalWrite(domeLed, LOW);
unsigned long delta = millis()-time;
if(delta<500) {
Keyboard.press(0x20); // SPACE
} else if(delta<1500) {
Keyboard.press(KEY_LEFT_ARROW); // or KEY_BACKSPACE
} else {
Keyboard.press(KEY_ESC); // for bird view with Reveal.js
}
delay(100);
Keyboard.releaseAll();
flag=false;
}
}
</source>

Latest revision as of 07:48, 8 October 2014

Big Dome Box

Matériel

Design

Logiciel

Emergency Logout

http://www.arduino.cc/en/Tutorial/KeyboardLogout

Spacebar for presentation, movie pause&resume, ...

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;
  }
}

for Reveal.js


const int domeButton = 12;
const int domeLed = 13;
boolean flag=false;
unsigned long time;

void setup() {
  pinMode(domeLed, OUTPUT);
  pinMode(domeButton, INPUT_PULLUP);
  Keyboard.begin();
}

void loop() {
  
  if (!flag && digitalRead(domeButton) == HIGH) {
    digitalWrite(domeLed, HIGH);
    time = millis();
    delay(100);
    Keyboard.releaseAll();
    flag=true;
  }
  if (flag && digitalRead(domeButton) == LOW) {
    digitalWrite(domeLed, LOW);
    unsigned long delta = millis()-time;
    if(delta<500) {
      Keyboard.press(0x20); // SPACE
    } else if(delta<1500) {
      Keyboard.press(KEY_LEFT_ARROW); // or  KEY_BACKSPACE 
    } else {
      Keyboard.press(KEY_ESC); // for bird view with Reveal.js
    }
    delay(100);
    Keyboard.releaseAll();
    flag=false;
  }
}