View Single Post
  #1   Spotlight this post!  
Unread 01-02-2014, 09:55
toastergod's Avatar
toastergod toastergod is offline
Programming Wizard
AKA: Sam Lehman
FRC #0279 (Tech Fusion)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: United States
Posts: 7
toastergod is an unknown quantity at this point
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();
        
    }
}
TestProject.java:

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() {
    
    }
}
I have attempted to search in and outside of Chief Delphi and I have not found anything. Thank you for your assistance.
Reply With Quote