View Single Post
  #1   Spotlight this post!  
Unread 14-12-2011, 17:36
Stonemotmot Stonemotmot is offline
Registered User
FRC #0486
 
Join Date: Sep 2011
Location: United States, Pa
Posts: 53
Stonemotmot is an unknown quantity at this point
Target Exception Error from Solenoid Array

Hello, I have recently been looking into making my solenoids operate
based off an Array. I get no build Errors or warnings. However when i
run it i get a Target Exception Error.
VxWorks6x_10.4.86: Exception in Kernal Task FRC_RobotTask:0x1e37368
at pc=0x1DE93B0 in RobotDemo::OperationControl()
at (Address of main.cpp)

Vector 0x300 : Data Access addr=0xEEEEEEE status=0xDC1630

The Code that matters

bool states [4] = {false,false,false,false}
bool prestates [4] = {false,false,false,false}
bool inoutbut [4] = {false,false,false,false}

class RobotDemo : public SimpleRobot
{
Solenoid* solenoids[5];
}
// more stuff inbetween

void OperatorControl(void)
{
solenoids[1] = new Solenoid(1);
solenoids[2] = new Solenoid(2);

while (IsOperatorControl)
{
for(int b=1; b<5; b++)
{
inoutbut[b] = stick.GetRawButton(b) // the stick is correctly defined

if(inoutbut[b] == true)
{
g=b;
states[g]= !prestates[g];
solenoid [g]->Set(states[g]) // the debugger shows this as wrong
prestates[g] = !prestates [g];
}
}
}