Arduino Player Buyer for FIFA

by UsherQ in Circuits > Arduino

388 Views, 2 Favorites, 0 Comments

Arduino Player Buyer for FIFA

jfjg.jpg

Hi, my name is Usher and I have made a player sniping bot for the FIFA 21 companion using an Arduino, the shortfuts Chrome extension, and the Processing IDE. It works by using pushbuttons to send input to the Arduino, which outputs a string to the serial monitor based on the input. The Processing program then takes the output from the Arduino and simulates a keypress based on the string printed using a switch statement.

With the Arduino Due and Leonardo, you wouldn't need the processing code since the Arduino IDE has a library that allows them to communicate with the PC keyboard directly called the Keyboard library. However, this library is not compatible with the UNO which is why the processing code is needed. To make this work for FIFA Companion in particular, I had to use the Chrome extension shortfuts to bind certain actions (buying and changing the buy it now and bid prices) to specific keys .

The switch's role is to change the function of the first button to toggle it between changing the minimum bid and buy now prices, which the Piezoelectric buzzer notifies you when you hit the buy button since if you spam it, the game will restrict you, so it is there to make sure there isn't an issue with the button, as that can be a significant problem. There are also 3 LEDs, whose roles are to remind you which button was last pressed (red for delete, green for buy, and yellow for search), and lastly, the potentiometer controls the brightness of these LEDs. The first button changes the bid/buy now prices, the second one is to search, the third one is to purchase a player, and the 4th one is to back out to repeat the process. This allows you to buy players quickly.

The reason I made this project is that it is a way to earn some coins in a game I like while doing an assignment at the same time. Since I'm buying players at prices below their market value before everyone else does, I can sell them for a profit. The profit per player ranges between 100-1500 assuming gold players are the ones bought. While this isn't the most efficient way, in my opinion, it is the coolest DIY way to do it. Now, onto the materials and other steps.

Materials

Programs/Extensions Needed

ard.jpg
proc.png
sf.png

Wiring

hoimeboi.jpg
bro.jpeg
lol.jpeg

Here is the wiring for the circuit. The pins for each component are as follows(these are in the code as well):

Piezo: pin 2

Delete button: pin 3

Buy button: pin 4

search button: pin 5

Buynow/Bid button: pin 6

Slideswitch: pin 8

Yellow LED: pin 9

Green LED: pin 10

Red LED: pin 11

Potentiometer: pin A0

Note that the LED's resistors can also be put to ground instead of through power and you can use 10k ohm resistors over the 560-ohm ones in case you don't have enough 560ohm ones. In case the picture is too messy, I have also attached the circuit made in TinkerCAD. Some of the components are different, however, all the pins are the same and the code still works with it. This circuit is really easy to add other buttons to and with some small modifications to the processing code, this type of circuit will work for any type of game or keyboard shortcut.

Code

At the start of the code are the pins I used for each component. You may change these if you like. The Arduino code primarily consists of If statements for each button. There is also a function used to turn 1 led on based on the input given from the potentiometer and turn the other 2 off. I also used another function to delay for .2 of a second. I could have just typed "delay(200);", however, this allowed me to make the code in slightly less time as well as make sure I did not mess anything up with the amount of delay.

The Processing part of the code is what presses the buttons on the keyboard. Processing is just a slightly altered form of Java, which is why most of the commands may look familiar to someone who already knows it. The line that takes the output from the Arduino is "MyPort = new Serial(this, "COM5", 9600);". If your code isn't working, you may have to change the port in the code. For example, if your Arduino is plugging into COM3, just write COM3 instead. The robot class specifically is what lets it click buttons on the keyboard. For example keyPress(VK_S); will press the S key. If you want to change which key is pressed, you can simply just change the letter. As I mentioned earlier, it takes the serial output from the Arduino and simulates a press of the keyboard based on the string received. You may notice that in the Arduino code, there is a colon at the end of each string. This is to help the Processing code find the end of each string. If the processing code doesn't run, make sure that the Arduino is running and that the Arduino serial monitor is not open. If it is, the code won't run because the 2 will conflict with each other. Below are the Processing and Arduino code I used for this project.

To download the code, just click on the files.

Shortfuts Keybinds

lllll.jpg
dld.jpeg
jhu.jpeg

Above are pictures of which keybind I use for each command in shortfuts (not all of them are needed). You can also change these if you want, but remember to adjust for that in the Arduino and Processing code files. Shortfuts is what allows the output to do things in the FIFA companion app. If you plan on modifying it for another game, this part is not needed.

Video

Arduino FIFA Sniper

Attached is a video of me giving a basic explanation of the circuit as well as showing how it works. Hope you enjoy!