Whats wrong with this code?

Can someone point out any logic problem or another error in this code. It would be greatly appreciated. Our kicker has 3 switches, (1) called proximity switch, (2) called safe switch, (3) called armed switch and a pneumatic cylinder and a compressor.

This is the logic to this the kicker.

Proximity Switch: connected to a motor.
Job: bring the kicker back up and then moving out of the way so it is safe to kick

Safe Switch: means " Almost all the way back"
Job: When this comes on, slow the motor connected to proximity switch

Armed Switch: “Ready to fire”
Job: When this comes on, wait for button. BUT check if proximity is out of the way.

The proximity switch is connected to a motor. When the robot is turned on this switch is set to retract back, bringing the kicker up in place, until the safe switch is on. When the safe switch comes on slow the motor down And keep going until Armed switch is on. When Armed is on the proximity switch is set to get out of the way, so it is safe to kick.

I decided that i should “build” and “deploy” the whole code on the robot and see what happens. … And so i did and … nothing happened. Something happened somehow which ruined the whole thing. The motor connected to proximity switch wasnt moving, not retracting, the pneumatic cylinder wasnt extending, retracting, NOTHING WAS happening besides the robot moving. I looked at the code several times, but i need help.

Help needed please Thank you :slight_smile:

pictures_of_code_1514.doc (269 KB)

pictures_of_code_1514.doc (269 KB)

I don’t see a problem with the code that I see.

First, I’d look at the Diagnostics tab to make sure there aren’t messages explaining that there was a misspelling or other explanation. Make sure that the watchdog hasn’t shut down the robot since I don’t see a feed anywhere on the screen.

Finally, with the robot in that state, place some probes via right clicking on wires, and push a button.

One thing I’ll throw out is that 10% motor power or 0.1 may not be enough to move the motor. If you see that your logic is correct and you are sending 10%, change the constants to controls so that you can tweak the values more easily, find the values that work, then make current values default.

Also, button one should be easier to debug as you can look at the solenoid module LEDs.

Greg McKaskle

Thank you for replying. I do not know what the problem could be, in the diagnostics window it does not show any error messages. And plus not even the solenoid extends. No changes occur when i press Number 2 (to move the motor) nothing happens.

When i started looking into the last years robot, i connected everything and enabled the robot. The robot worked fine, except we had one problem which i wanted to fix, which was that the motor connected to the proximity switch did not turn back. so i opened the code that was in the robot, which should be this one, because it had the latest date and it was named the FINALrobotcode. The only thing i changed was change motor speed from 0.1 to -0.1 when armed switch comes on. Then…All of a sudden something happend.

The code did not work and still does not…Help pleaseee

Team 1514
The Vikes :slight_smile:

You have a couple choices. If you believe that putting the 0.1 back to its old values will work, you might give that a try. Or, you can start debugging it with probes and the like. Determine if the joystick buttons get to the diagram and correspond to the button state. Determine if values are really being set on the motor controller block.

This will help to determine if it is just the SW, or possibly the electronics that needs debugging.

Greg McKaskle