-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/letsbuildrockets/ToF-CAN int…
…o dev
- Loading branch information
Showing
5 changed files
with
69 additions
and
23 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
import org.letsbuildrocekts.libs.TimeOfFlightSensor; | ||
package frc.robot; | ||
|
||
import org.letsbuildrockets.libs.TimeOfFlightSensor; | ||
|
||
import edu.wpi.first.wpilibj.TimedRobot; | ||
|
||
public class Robot extends TimedRobot { | ||
private TimeOfFlightSensor tofsensor; | ||
|
||
@Override | ||
public void robotInit() { | ||
tofsensor = new TimeOfFlightSensor(0x620); | ||
tofsensor = new TimeOfFlightSensor(0x621); | ||
System.out.println("ToF Sensor at " + String.format("0x%03x", tofsensor.getID()) + "! (with firmware version: " + tofsensor.getFirwareVersion().toString()+")"); | ||
} | ||
|
||
@Override | ||
public void teleopPeriodic() { | ||
if(tofsensor.inRange()) | ||
System.out.println("distance: " + tofsensor.getDistance()); | ||
else | ||
if(tofsensor.inRange()) { | ||
System.out.println("distance: " + tofsensor.getDistance()+ " " + tofsensor.getError()); | ||
} else { | ||
System.out.println("out of range"); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters