Minecraft klávesnice

Cenami ověnčený Minecraft je velmi oblíbená hra a také pěkně návyková. V roce 2009 ji pro PC vytvořil švédský programátor Markus “Notch” Persson a později přidal podporu pro několik dalších herních konzolí. Minecraft byl také v roce 2014 koupen Microsoftem za neuvěřitelných 53 miliard korun.
Nadšenec do Arduina i Minecraftu s přezdívkou Lakhanm vytvořil klávesnici s pomocí Arduina, která nahrazuje všechny základní tlačítka nutná pro hraní Minecraftu. Projekt je možné rozběhnout na deskách Arduino Micro, Arduino Leonardo a ostatních, které podporují knihovnu Keyboard. Pokud si jej chcete vyzkoušet, stačí vzít tlačítka, rezistory, kontaktní pole s vodiči a můžete se pustit do bastlení.
Program pro Minecraft ovladač
Do vaší Arduino desky nahrajte následující kód.
#include <Keyboard.h>
void setup() { //This runs only once
pinMode(2, INPUT_PULLUP);//Define pin 2 as input
pinMode(3, INPUT_PULLUP);//Define pin 3 as input
pinMode(4, INPUT_PULLUP);//Define pin 4 as input
pinMode(5, INPUT_PULLUP);//Define pin 5 as input
pinMode(6, INPUT_PULLUP);//Define pin 6 as input
pinMode(7, INPUT_PULLUP);//Define pin 7 as input
pinMode(8, INPUT_PULLUP);//Define pin 8 as input
pinMode(9, INPUT_PULLUP);//Define pin 9 as input
pinMode(10, INPUT_PULLUP);//Define pin 10 as input
Keyboard.begin();
}
void loop() { //Runs continuously
if(digitalRead(2) == HIGH){ //If the button 2 is pressed
Keyboard.write(113);//Drop item (q)
delay(200);//Wait 0.2 seconds
}
if(digitalRead(3) == HIGH){ //If the button 3 is pressed
Keyboard.write(101);//Inventory (e)
delay(1000);//Wait 1 second
}
if(digitalRead(4) == HIGH){ //If the button 4 is pressed
Keyboard.press(KEY_LEFT_SHIFT);//Sneack (LShift)
delay(200);//Wait 0.2 seconds
Keyboard.releaseAll();//Release the key
}
if(digitalRead(5) == HIGH){ //If the button 5 is pressed
Keyboard.press(' ');//Jump /Fly (Space Bar)
delay(20);//Wait 0.02 seconds
Keyboard.releaseAll();//Release the key
}
if(digitalRead(6) == HIGH){ //If the button 6 is pressed
Keyboard.press('w');//Walk Forwards (W)
delay(200);//Wait 0.2 seconds
Keyboard.releaseAll();//Release the key
}
if(digitalRead(7) == HIGH){ //If the button 7 is pressed
Keyboard.press('s');//Walk Bakcwards (S)
delay(20);//Wait 0.02 seconds
Keyboard.releaseAll();//Release the key
}
if(digitalRead(8) == HIGH){ //If the button 8 is pressed
Keyboard.press('a');//Strafe Left (A)
delay(200);//Wait 0.2 seconds
Keyboard.releaseAll();//Release the key
}
if(digitalRead(9) == HIGH){ //If the button 9 is pressed
Keyboard.press('d');//Walk Backwards (D)
delay(200);//Wait 0.2 seconds
Keyboard.releaseAll();//Release the key
}
if(digitalRead(10) == HIGH) { //If the button 10 is pressed
Keyboard.press(KEY_ESC);//Escape(Pause)
delay(1000);//Wait 1 second
Keyboard.releaseAll();//Release the key
}
}
Přeloženo z http://blog.arduino.cc/2014/09/22/a-keyboard-for-minecraft-addicted/comment-page-1/ a mírně upraveno.
- Sledovač slunce s Arduinem - 8.10.2025
- Ovládání microbit robota přes dálkový ovladač - 8.10.2025
- ESP IDE & Pico:ed – Instalace firmware a seznámení s editorem - 4.9.2025

