When I play minecraft I always had one issue that bother me which is afk. When I need to go somewhere else and need to do "Away from keyboard" I wanted to have a device to let me afk right away. Of course you can build a afk machine for your world and press down left click to grind mobs while doing other stuff with your other monitor or arm, if don't want to waste time on building a arduino project like this, but the advantage of this project that you wouldn't need to do anything and it will afk it self for you. (you might build a afk pool in a far away place, or you real life self really need to go somewhere else but still want to grind mobs) So this is the solution for you. (if you needed) In this tutorial I will teach you guys how to do Afk machine for walking (plus shift) or a afk machine for grinding (Remember this is only for 1.9 Ver. and below) Overall the trick is like this when the sensor couldn't detect your hand on the mouse it starts to afk, and when your hand is on the mouse then it turn back to normal state and you can get your control back. The code is actually pretty simple and I will teach you guys in few steps so it won't be messy and hard to follow. If you are ready then follow on!!! :) (P.S. Don't forget it is only for PC only, console players I am sorry :(
Arduino Leonardo x 1 (or DUE but I am using Leonardo although there isn't much differences but idk will happen if you are using Uno)
Wires x 4
Breadboard x 1
Ultrasonic distance sensor x 1
Mouse x 1
usable PC x 1 (that can use USB)
Step 1: Connecting Together / Circuit
This isn't a very hard project, the only thing that you need connect is the sensors and the wires, the rest just leave it for the command. First off, plug the sensor to the down right cornor as the picture shows, and plug 5V line to the 5V icon behind the sensor and do the rest like so. Then REMEMBER to connect a wire from GND to PWM 4, otherwise this circuit won' work. And~~~ you are done, let's continue on the code.
Step 2: the Code
The first code (sketch_jun03a) is for the AFK machine same like the usage of the AFK pool, and the code is fairly simple, and if u want to change it, for example want to change the walking area then change the delay time between the press the button and release the button.
The second code (sketch_may21a) is the AFK mod farmer, so basically it will click left click continuously, which if you are playing a faction server then you can grind like blaze and other mod while afking.
(P.S. I found out that it will be better and improve accuracy, if you set the ultrasonic sensor's distance further.)
Step 3: Appearance (AKA the Outside Design)
Cause we are doing a AFK machine for minecraft, then I think it is perfectly suit the theme if we do a 3D model of the AFK pool with cardboard, and super glue. (BTW you can still perfectly your arduino machine even without the outside design, it is just for fun.) First off, get a cardboard and cut 2 rectangles with 7x12 cm for the sides, and 1 19x7 cm rectangle for the back, then do a 18x13.5 rectangle for the top, last do 4 5x1.5 cm rectangle for the pole to give a afk pool feel. assemble all that together you will get something like the picture shown on top. (also notice that you need to cut a hole for the cardboard from the down left corner so you can plug in your wires.) then you are done feel free to mess around with the code and enjoy :)
Step 4: The Final Result
This the final result and give u guys a idea how does it work, and how it perform.