-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTowwer_3D_trigger.ino
48 lines (29 loc) · 1012 Bytes
/
Towwer_3D_trigger.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
#include "DigiKeyboard.h"
const int buttonPin = 0; // the number of the pushbutton pin
const int ledPin = 1;
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the digital pin as an output.
DigiKeyboard.sendKeyStroke(0);
pinMode(ledPin, OUTPUT); //LED on Model B
pinMode(buttonPin, INPUT); //button
}
// the loop routine runs over and over again forever:
// DigiKeyboard.sendKeyStroke(0);
// DigiKeyboard.delay(5000);
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
DigiKeyboard.sendKeyPress(0,MOD_SHIFT_LEFT);
//DigiKeyboard.println("Hello Digispark!");
} else {
// turn LED off:
DigiKeyboard.sendKeyStroke(0);
digitalWrite(ledPin, LOW);
}
}