Minecraft Arduino Hacks
Are you tired of making a base by plain creative mode? this will (maybe) help you.
this project requires Leonardo Arduino and ardublock.
three Minecraft controls, you can make more and interesting controls. I use block switching, breaks blocks, and mega-hole.
you use sensors to detect movement, then use the keyboard/mouse function of Leonardo Arduino to type in commands or press the keyboard, very simple.
there are two types of basic controls: quick press ( quickly pressing to press it quicker and complicated that I and you can't do), and commands ( use /commands to insert complicated/time-consuming commands so it's easier to insert or you just want to mess arround.
How to Code a Quick Pressing Mechanism
just code that it can press fast and quickly so you don't need all that pressing! you should make it ten milliseconds a press. you can swap and break blocks quickly, you can fight mobs quickly in survival!
this coding is simple, just type in the mouse command, press, and wait.
How to Type in Minecraft /commands
press "/" type in the commands! if you want to change the power, use a variable instead of "message".
this is much more easier using ardublock, because you need to split everything up, this is just for lazy people
, some people just types it in word-by-word or do not use commands, I respect you, but don't you want a super charged creeper in your friend's house?
"literally" Coding
it's time we code! you can make your own by using ardublock, or someone uses the hard way, I respect them.
you can copy the code below, or use ardublock to easily make your own, remember to only use keyboard command enabled arduino boards. if you don't know what's ardublock, search it!
as promised, the code:
#include
#include
int _37 ; int _27 ; /* These core libraries allow the 32u4 and SAMD based boards (Leonardo, Esplora, Zero, Due and MKR Family) to appear as a native Mouse and/or Keyboard to a connected computer. */
void setup(){ // put your setup code here, to run once: pinMode( 5 , INPUT); // sets the digital pin as input Keyboard.begin(); // initialize control over the keyboard Keyboard.releaseAll();
pinMode( 6 , INPUT); // sets the digital pin as input Mouse.begin(); // initialize control over the mouse pinMode( 7 , INPUT); // sets the digital pin as input }
void loop(){ // put your main code here, to run repeatedly: swap(); hole(); megahole(); _37 = ( analogRead( A0 ) / 100 ) ; _27 = ( analogRead( A1 ) / 100 ) ; }
void megahole() { //customised function if (digitalRead( 5 )) { delay( 3000 ); // waits a few milliseconds
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("z"); //Send the message } delay( 100 ); // waits a few milliseconds
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("fill"); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.press(32); //the key to press (ASCII code) } Keyboard.release(32);
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("~"); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print(_37); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.press(32); //the key to press (ASCII code) } Keyboard.release(32);
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("~"); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print(_37); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.press(32); //the key to press (ASCII code) } Keyboard.release(32);
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("~"); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print(_37); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.press(32); //the key to press (ASCII code) } Keyboard.release(32);
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("~-"); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print(_27); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.press(32); //the key to press (ASCII code) } Keyboard.release(32);
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("~-"); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print(_27); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.press(32); //the key to press (ASCII code) } Keyboard.release(32);
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("~-"); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print(_27); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.press(32); //the key to press (ASCII code) } Keyboard.release(32);
pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.print("air replace"); //Send the message } pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Keyboard.press(176); //the key to press (ASCII code) } Keyboard.releaseAll(); } }
void hole() { //customised function if (digitalRead( 6 )) { delay( 3000 ); // waits a few milliseconds for (int k = 0 ; k < 1000 ; ++k ) { pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Mouse.click(MOUSE_LEFT); } delay( 10 ); // waits a few milliseconds } } }
void swap() { //customised function if (digitalRead( 7 )) { delay( 3000 ); // waits a few milliseconds for (int i = 0 ; i < 9 ; ++i ) { pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Mouse.click(MOUSE_LEFT); } delay( 10 ); // waits a few milliseconds pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground if(digitalRead(4)==LOW){ // do nothing until pin 4 goes low Mouse.click(MOUSE_RIGHT); } delay( 1000 ); // waits a few milliseconds } } }
ReplyForward
change the input to work, d4 connect GND
the wiring is simple, use any sensor!