Log in

View Full Version : Double Solenoid error in Eclipse


BananaKing1378
22-01-2015, 22:46
Hello! We are currently trying to set up a double acting solenoid in Eclipse.

First we create a DoubleSolenoid called Solenoid with the following line:
DoubleSolenoid Solenoid;

Next we construct it:
Solenoid(0,1);

Next, we try to set the Solenoid to forward. This is where the problem occurs. We are told that there is no member named "Forward". We have tried various ways of calling "set". Currently, we are using:

Solenoid.Set(DoubleSolenoid::kForward);

GeeTwo
22-01-2015, 23:08
Hello! We are currently trying to set up a double acting solenoid in Eclipse.

First we create a DoubleSolenoid called Solenoid with the following line:
DoubleSolenoid Solenoid;

Next we construct it:
Solenoid(0,1);

Next, we try to set the Solenoid to forward. This is where the problem occurs. We are told that there is no member named "Forward". We have tried various ways of calling "set". Currently, we are using:

Solenoid.Set(DoubleSolenoid::kForward);

Sounds like you're using C++, since :: is not part of java.

Doing a bit of googling, I found that kForward is actually a member of the class "Value" defined within DoubleSolenoid. I have never written any c++, but as I read the docs online, my best guess at this line would be:
Solenoid.Set(DoubleSolenoid::Value.kForward);

Alan Anderson
23-01-2015, 11:25
DoubleSolenoid Solenoid;

Just a thought -- is the name "Solenoid" conflicting with a library class name? Pick something a little more descriptive, like "gearselect" or "toteflipper" and see if the error remains.

JefferMC
25-01-2015, 17:33
Sounds like you're using C++, since :: is not part of java.

Doing a bit of googling, I found that kForward is actually a member of the class "Value" defined within DoubleSolenoid. I have never written any c++, but as I read the docs online, my best guess at this line would be:
Solenoid.Set(DoubleSolenoid::Value.kForward);

Close, "Value." isn't necessary, the correct parameter value would be:

DoubleSolenoid::kForward

Keep in mind that if you should be able to type DoubleSolenoid, the two colons and pause, Elipse should list members of DoubleSolenoid for you. I believe the constants appear near the end.

bob.wolff68
28-01-2015, 01:26
I'm voting with Alan on this one - change the name of your 'variable' Solenoid to something else. Both of those names are class names. That could be problematic.