View Single Post
  #12   Spotlight this post!  
Unread 05-05-2010, 23:15
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Help with PSoC board programming please

To use the DriverStation functions, you have to create a DriverStation pointer and set it with DriverStation::GetInstance(). You can then use GetDigitalIn only on the first 8 pins. The DS must also be set to Compatible I/O mode (through I/O screen). If you want to use any of the advanced functionality available through the PSoC board, the system is a bit different (will show with code)

Using DriverStation
Code:
public:
...
DriverStation *ds;
...
MyRobot() {
...
ds = DriverStation::GetInstance()
...
}

Teleop() {
...
switch = ds->GetDigitalIn(1);
...
}
Using DriverStationEnhancedIO:
Code:
Teleop() {
DriverStationEnhancedIO& dsio = DriverStation::GetInstance()->GetEnhancedIO();
...
switch = dsio.GetDigital(1);
...
}
IMO you should use the DriverStationEnhancedIO version since you can have more control over the PSoC (pulled high/pulled low, input/output, encoder support, LEDs)
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote