Minecraft Sb Mining
mining stone easily!
Code
#include
#include
/* 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: Serial.begin(9600); // opens serial port, sets data rate to 9600 bps pinMode( 2 , INPUT); // sets the digital pin as input Keyboard.begin(); // initialize control over the keyboard Keyboard.releaseAll();
Mouse.begin(); // initialize control over the mouse }
void loop(){ // put your main code here, to run repeatedly: Serial.print(digitalRead( 2 )); //print message Serial.print(" "); //print a blank Serial.println(); if (digitalRead( 2 )) { for (int i = 0 ; i < 10 ; ++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 Keyboard.press('w'); //the key to press (ASCII code) } 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.press(MOUSE_LEFT); } delay( random( 300 , 1000 ) ); // 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.move(0, random( 0 , 20 ), 0); } 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.move(0, random( -20 , 0 ), 0); } } } }