View Single Post
  #1   Spotlight this post!  
Unread 18-02-2012, 13:54
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Honeywell Microswitch (Limit Switch)

Quote:
Originally Posted by dmitch View Post
I would appreciate if you could explain the DriverStation LCD class. We're using the switch for if the ball is at the correct position to shoot, so a simple output like "Ready for Shot" or something along those lines would really help. Thanks!
You can paste the following macros into your file and use them. Note that these set of macros make life easier but the double paranthesis on LCDUpdate is required to make the macro work. You only need to call LCDUpdate once per loop. It refreshes the message display on the Driver Station. In other words, you can call LCDPrintf on several things, one per LCD line and then call LCDUpdate once to "deliver" the lines to the driver station.
Code:
#define LCD_LINE1               DriverStationLCD::kUser_Line1
#define LCD_LINE2               DriverStationLCD::kUser_Line2
#define LCD_LINE3               DriverStationLCD::kUser_Line3
#define LCD_LINE4               DriverStationLCD::kUser_Line4
#define LCD_LINE5               DriverStationLCD::kUser_Line5
#define LCD_LINE6               DriverStationLCD::kUser_Line6
#define LCDPrintf(p)            DriverStationLCD::GetInstance()->PrintfLine p
#define LCDUpdate()             DriverStationLCD::UpdateLCD()
 
class MyRobot: public SimpleRobot
{
    
public:
    MyRobot()
    {
    }
 
    ~MyRobot()
    {
    }
 
    void Autonomous(void)
    {
    }
 
    void OperatorControl(void)
    {
        while (IsEnabled() && IsOperatorControl())
        {
            LCDPrintf((LCD_LINE1, "ReadyToFire = %d", m_switchState));
            ....
            LCDUpate();
        }
    }
};
__________________
Reply With Quote