|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Displaying Data in the Driver Station Output
I have written a program that is supposed to take a value given by a potentiometer, and display it in the driver station output. I have tried using
"System.out.println();" however this does not output to the driver station. I then attempted to use "driverStat.println(DriverStationLCD.Line.kMai n6, startingColumn, "Potentiometer: " + POT.get());". This however does not output anything either. Any fiddling with the potentiometer will not display anything. Here is my full code: TF_PrintPot.java: Code:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package POTcheck;
import edu.wpi.first.wpilibj.DriverStationLCD;
import edu.wpi.first.wpilibj.AnalogPotentiometer;
public class TF_PrintPot {
public AnalogPotentiometer POT = new AnalogPotentiometer(1,1);
public DriverStationLCD driverStat = DriverStationLCD.getInstance();
public int startingColumn = 1;
public TF_PrintPot() {
}
public void pot () {
System.out.println(POT.get());
driverStat.println(DriverStationLCD.Line.kMain6, startingColumn, "Pot " + POT.get());
driverStat.updateLCD();
}
}
Code:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package POTcheck;
import edu.wpi.first.wpilibj.SimpleRobot;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class TestProject extends SimpleRobot {
/**
* This function is called once each time the robot enters autonomous mode.
*/
public TF_PrintPot POTrun = new TF_PrintPot();
public void autonomous() {
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
while(true) {
POTrun.pot();
}
}
/**
* This function is called once each time the robot enters test mode.
*/
public void test() {
}
}
|
|
#2
|
|||
|
|||
|
Re: Displaying Data in the Driver Station Output
Just a question, are you using smart dashboard or something of that nature?
|
|
#3
|
||||
|
||||
|
Re: Displaying Data in the Driver Station Output
Looking at the Javadoc for DriverStationLCD.Line, it says that DriverStationLCD.Line.kMain6 has been deprecated. Try using DriverStationLCD.Line.kUser1 instead.
|
|
#4
|
||||
|
||||
|
Re: Displaying Data in the Driver Station Output
I am not using smart dashboard as far as I've been informed by my team leader.
|
|
#5
|
||||||
|
||||||
|
Re: Displaying Data in the Driver Station Output
I don't see anything obviously wrong with your code, with the exception that there is no delay in your while loop in operatorControl. Are you enabling the robot on the driver station? Are you looking for the messages on the User Messages display on the operations tab of the driver station?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|