An external hardware class is a very easy way to abstract your code to make your code much more concise and follow a very organized "flow"
Some of the benefits include having one instance of everything. In this case, you don't have to initialize every single motor in every single auto or teleOp you create, they will all be created for you.
Why use it?
It allows you to not repeat yourself when coding. Often young coders have every single motor or servo initialized in every single program when that is not entirely necessary. This in general cleans up your code and makes it much easier to read.
Start with creating a new class, probably called HardwareConfig, or something of that sort.
Then define all of your motors, servos, and variables you normally use.
Make a function called "initRobot" or something of that sort. That will allow you to have a good function. This should take parameters such as an opMode, HardwareMap and maybe an auto (boolean) so you can initialize things differently in auto versus teleOp.
Make a function that will handle all teleOp "logic". This is handy because you will only need to call one function during your teleOp code.
For instance, this is an example of my code: NOTE: This will NOT work on your machine just by itself, you will need to replace almost everything with your own code
Use this code in order to get an idea of what you would like to do with your external hardware class.
Create an object called "robot" or something else of that sort.
Make that object a HardwareConfig object so it will initialize correctly.
Use it all together
NOTE as with above, this code will not work for you, I would HIGHLY suggest writing it all yourself, even if you struggle, just so you know how it all works together
packageorg.firstinspires.ftc.teamcode.opModes.teleOp;importcom.qualcomm.robotcore.eventloop.opmode.LinearOpMode;importcom.qualcomm.robotcore.eventloop.opmode.TeleOp;importorg.firstinspires.ftc.teamcode.opModes.HardwareConfig;@TeleOp(group ="a")publicclassteleOpextendsLinearOpMode { @OverridepublicvoidrunOpMode() {HardwareConfig robot =newHardwareConfig(this, hardwareMap,false);//^ creates our "robot" class with the params of opMode, HardwareMap and autowaitForStart();while (opModeIsActive()) {robot.doBulk(); // main function we defined above in the HardwareConfig } }}