Skip to content

Instantly share code, notes, and snippets.

@yswallow
Created June 5, 2019 23:09
Show Gist options
  • Select an option

  • Save yswallow/c2aa3285649cbdb469d079ae0677c1be to your computer and use it in GitHub Desktop.

Select an option

Save yswallow/c2aa3285649cbdb469d079ae0677c1be to your computer and use it in GitHub Desktop.
Digisparkでじゅげむをタイピングする
#include "DigiKeyboard.h"
void setup() {
// don't need to set anything up to use DigiKeyboard
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(0, INPUT_PULLUP);
digitalWrite(2, LOW);
}
void loop() {
if(digitalRead(0) == LOW) {
// this is generally not necessary but with some older systems it seems to
// prevent missing the first character after a delay:
DigiKeyboard.sendKeyStroke(0);
digitalWrite(1, HIGH);
DigiKeyboard.sendKeyStroke(0x2C);
// Type out this string letter by letter on the computer (assumes US-style
// keyboard)
DigiKeyboard.print("jugemujugemugokounosurikire");
DigiKeyboard.print("kaijarisuigyonosuigyoumatu");
DigiKeyboard.print("unnraimatsuhuuraimatsu");
DigiKeyboard.print("kuunerutokoronisumutokoro");
DigiKeyboard.print("yaburakoujinoburakouji");
DigiKeyboard.print("paipopaipopaiponoshu-rinngann");
DigiKeyboard.print("shu-rinngannnogu-rinndai");
DigiKeyboard.print("gu-rinndainoponnpokopi-noponnpokona-no");
DigiKeyboard.print("choukyuumeinochousuke");
digitalWrite(1, LOW);
}
// It's better to use DigiKeyboard.delay() over the regular Arduino delay()
// if doing keyboard stuff because it keeps talking to the computer to make
// sure the computer knows the keyboard is alive and connected
DigiKeyboard.delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment