Changes between Version 6 and Version 7 of ControlSystems/SampleCode/Ultrasonic
- Timestamp:
- Nov 3, 2019, 11:37:32 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SampleCode/Ultrasonic
v6 v7 3 3 4 4 1. Create a new project named Ultrasonic2. 5 1. Download the attached Ultrasonic2537.java and save it in the src/main/java/frc/robot folder. 5 1. Download the attached Ultrasonic2537.java and save it in the src/main/java/frc/robot folder. This file is needed because the default Ultrasonic class provided with WPILib is defective and does not work with more than one ultrasonic sensor. 6 6 1. Replace the auto-generated Robot.java class with the one below 7 8 * Notice that we don't need to import the Ultrasonic2537 class because it is declared to be in the same package as the Robot class (package frc.robot). 7 9 8 10 {{{ … … 61 63 @Override 62 64 public void robotPeriodic() { 63 SmartDashboard.putNumber("front distance", front.getRangeInches()); 64 SmartDashboard.putNumber("rear distance", rear.getRangeInches()); 65 if (front.isRangeValid()) 66 SmartDashboard.putNumber("front distance", front.getRangeInches()); 67 if (rear.isRangeValid()) 68 SmartDashboard.putNumber("rear distance", rear.getRangeInches()); 65 69 } 66 70 … … 113 117 } 114 118 } 115 116 119 }}}