== More Java Robot Examples Learn more about robot programming by studying more simple example programs. Run them, study what they do, and incrementally expand their functionality. The WPILib software you installed includes example programs that you can compile and run on a RoboRIO. Review [https://wpilib.screenstepslive.com/s/currentCS/m/79833/l/941601-vs-code-basics-and-wpilib-in-vs-code how to use VSCode] and then try [https://wpilib.screenstepslive.com/s/currentCS/m/79833/l/932465-creating-a-new-wpilib-project-in-vs-code creating a new robot project]. * WPILib provides [https://wpilib.screenstepslive.com/s/currentCS/m/java/l/599697-choosing-a-base-class 3 frameworks] for building robot programs. Build your first program using the !TimedRobot (previously had been !IterativeRobot) framework as described [https://wpilib.screenstepslive.com/s/currentCS/m/java/l/145307-creating-your-benchtop-test-program here]. * Connect your laptop to the RoboRIO USB port or !WiFi * Connect your joystick or xbox controller to another USB port on your laptop * Launch the NI Driver Station Software. For details see [https://wpilib.screenstepslive.com/s/4485/m/24192/l/144976-frc-driver-station-powered-by-ni-labview here] * Confirm that the software detects your joystick/controller and responds to button presses and stick movement * Use Microsoft Internet Explorer (not Chrome or Firefox) to connect to the RoboRIO's web interface (usually at http://172.22.11.2) and confirm that you have connectivity with the RobORIO * Create a test project and follow [https://wpilib.screenstepslive.com/s/currentCS/m/79833/l/932465-creating-a-new-wpilib-project-in-vs-code these instructions] to build, load, and run it on your RoboRIO/Robot * Create another WPILib project based on the !TimedRobot framework * Study an [wiki://ControlSystems/IntroRobotJava/HazelnutSample1 example program]. This is a simple program for one of our test robots: Peanut 2 (Hazelnut) * 2-wheel-drive (2WD) robot with two CIM motors driving plaction wheels * Motors are controlled by Talon SRX smart motor controllers; these are networked to the roboRIO (robot control computer) using CAN bus and are at addresses 3 (left motor) and 4 (right motor) * An ultrasonic sensor for forward collision avoidance connected to roboRIO digital I/O pins (DIO) 0 and 1 * A USB camera so you can drive even when you can't see the robot * The driver controls the robot using the two analog sticks on an X-box game controller * Copy the program below over the default Robot.java created by the framework * Use the WPILib->Manage Vendor Libraries->Install New Libraries Offline->select the CTRE Framework * More sample code for Hazelnut (peanut robot) is [wiki:ControlSystems/SampleCode/Hazelnut here] * You can learn more about FRC robot programming [https://frc-pdr.readthedocs.io/en/latest/index.html here] * You can learn more about game controllers [https://github.com/MTHSRoboticsClub/Documentation/wiki/Drive-Controller-Comparison here] * Note: the sample program assumes two !TalonSRX motor controllers at IDs 3 and 4. You can set them using the CTRE Phoneix Tuner * Note: the !RoboRIO web web interface is available via browser at 10.25.37.2