Created
March 28, 2020 16:01
-
-
Save wotakuro/4923bf0cf5d1b820376d2727b2bdca02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "DigiKeyboard.h" | |
const int LED_PIN = 0; | |
const int LED_PIN2 = 1; | |
const int BTN_PIN = 2; | |
void setup() { | |
// don't need to set anything up to use DigiKeyboard | |
pinMode(LED_PIN,OUTPUT); | |
pinMode(LED_PIN2,OUTPUT); | |
pinMode(BTN_PIN,INPUT); | |
DigiKeyboard.sendKeyStroke(0); | |
} | |
void loop() { | |
int val = 0; | |
val = digitalRead( BTN_PIN); | |
if( val != HIGH ){ | |
DigiKeyboard.sendKeyStroke(KEY_ENTER); | |
digitalWrite(LED_PIN , HIGH); | |
digitalWrite(LED_PIN2 , HIGH); | |
}else{ | |
digitalWrite(LED_PIN , LOW); | |
digitalWrite(LED_PIN2 , LOW); | |
DigiKeyboard.delay(8); | |
} | |
DigiKeyboard.delay(2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment