introduction_to_frc_programming
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| introduction_to_frc_programming [2026/04/08 14:25] – [Programming Concepts] ztif33 | introduction_to_frc_programming [2026/04/08 14:47] (current) – [Variable - Object] ztif33 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ~~SLIDESHOW | + | ~~SLIDESHOW |
| ====== Introduction to FRC Programming ====== | ====== Introduction to FRC Programming ====== | ||
| Line 14: | Line 14: | ||
| * Syntax is based off of C/C++ | * Syntax is based off of C/C++ | ||
| * Strongly and Statically Typed | * Strongly and Statically Typed | ||
| - | |||
| ===== Why do we use Java? ===== | ===== Why do we use Java? ===== | ||
| Line 50: | Line 49: | ||
| * Text | * Text | ||
| * References to hardware | * References to hardware | ||
| + | |||
| + | ===== Variable Examples ===== | ||
| + | |||
| + | <code java> | ||
| + | // CAN IDs | ||
| + | public int lfDriveMotorID = 1; | ||
| + | public int lrDriveMotorID = 2; | ||
| + | public int rfDriveMotorID = 3; | ||
| + | public int rrDriveMotorID = 4; | ||
| + | |||
| + | // Drivetrain Constants | ||
| + | public Distance wheelDiameter = Inches.of(3); | ||
| + | public double driveRatio = 1.0/8.45; | ||
| + | </ | ||
| + | |||
| + | ===== Variable - Primitives ===== | ||
| + | |||
| + | | | Type | Description | | ||
| + | | Boolean | bool | true or false, 0 or 1 | | ||
| + | | Integers | byte | Whole number from -128 to 127 | | ||
| + | | ::: | short | Whole number from -32,768 to 32,767 | | ||
| + | | ::: | int | Whole number from -2, | ||
| + | | ::: | long | Whole number -9, | ||
| + | | Floating Point | float | Fractional Number Significant to 6 to 7 decimal places | | ||
| + | | ::: | double | Fractional Number Significant to 15 decimal places | | ||
| + | | Character | char | Stores a single character/ | ||
| + | |||
| + | ===== Variable - Object ===== | ||
| + | * An object is a collection of variables and methods. | ||
| + | * Used to logically group things together in programs. | ||
| + | * Example: The Drivetrain object includes all the drive motors | ||
| + | * Fundamental part of java | ||
| ---- | ---- | ||
| - | This is how your program remembers what it is doing. | + | All variables in Java, except for primitive types, are an object. |
| + | |||
introduction_to_frc_programming.1775672727.txt.gz · Last modified: by ztif33
