-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Open
Description
I know that you can find the battery of the control hub by:
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.VoltageSensor;
@TeleOp(name = "MonitorVoltageOpMode", group = "FTC")
public class MonitorVoltageOpMode extends LinearOpMode {
@Override
public void runOpMode() {
telemetry.addData("Status", "Initialized");
telemetry.update();
waitForStart();
while (opModeIsActive()) {
// Get the primary voltage sensor from the hardware map
// The FtcRobotController automatically puts voltage sensors into the hardware map
VoltageSensor batterySensor = hardwareMap.voltageSensor.iterator().next();
// Read the voltage
double voltage = batterySensor.getVoltage();
// Display the voltage on the Driver Station telemetry
telemetry.addData("Robot Battery Voltage", "%.2f V", voltage);
telemetry.update();
}
}
}But why cant you find the battery level of the driver hub?
Metadata
Metadata
Assignees
Labels
No labels