|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need some quick advice
We are doing a demonstration at the halftime show of a school basketball game in a few hours, and I am trying to code up a button to make it easier on us.
Last night we tested and it works fine, but I do not have an intuitive control system set up. Our robot uses a belt to raise the ball to our shooter, and then we run the shooter, and fire a pneumatic kicker to kick the ball into the shooter. the main problem is with people forgetting to retract the kicker, which will stop the belt if you forget (I have done this many times), so I want it to automatically retract. I want to use the simple .get() button command to run the program, and this is what I would like it to do in pseudocode. if (joystickbutton.get()){//runs the program when button is held down if (programrun? = false){//will run program if has not been run before shootermotors.set(1);//turns on the shooter wait (untilshootersatmaxspeed);//usually about 3-4 seconds solenoid.extend;//kicks the ball into the shooter wait (untilsolenoidisextended);//waits until the solenoid is kicked fully solenoid.retract;//puts the solenoid back in position shootermotors.set(0);//turns off the motors programrun = true;//sets it so the program doesnt run more than once } } else{ programrun = false;//so that when i take finger off button program can be run again } here is my actual code which does not work as intended, I have declared everything before. if (zero.get()){//if joystick is held down if (MYVAL = false){//if program hasnt been run topshoot.set(1);//sets speed of top part of shooter bottomshoot.set(-1);//sets speed of bottom part of shooter Timer.delay(4);//waits im assuming 4 seconds s1.set(true);//sets the solenoid to the right value to extend s2.set(false);//sets the solenoid to the right value to extend Timer.delay(3);//waits im assuming 3 seconds s1.set(false);//sets the solenoid to the right value to retract s2.set(true);//sets the solenoid to the right value to retract topshoot.set(0);//turns off the top motor bottomshoot.set(0);//turns off the bottom motor MYVAL = true;//makes it so program cant be run more than once } } else{ MYVAL = false;//sets it so the program can be run again } any quick ideas about what could be wrong would be appreciated. tyvm in advance |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|