|
Re: Momentary On/Off
Ok, I wrote a bunch of code in the past several hours.
I scrapped the original idea, and rather went with something slightly different.
1. Button is TAPPED
2. Motor Turns on for X seconds, for V speed
3. Motor reverses, at V/4 for 4X seconds
4. Motor is back at home position
To do this I used 2 case structures in my TeleOp Code. I used a joystick get button for, well, getting the button, and wired each joysticks button 1(trigger) to the case. When button is pressed, it is True, in turn running the code in that case. The code, how I have it written in the case, will take about 1.25 seconds to complete what I want it to do. However, I am concerned that the trigger, button 1, will have to be held for 1.25 seconds for the code to complete, insteads of just having to tap it to run the entire code. I haven't done anything like this, and obviously I can't test it on the robot. So, will the code finish if I only tap the trigger which activates it?
BTW, I am using Watchdog DELAY&FEED to do the timing. That is alright to do, right? I just finally understood autonomous coding today, so I applied the watchdog timing concept to this.
__________________
I'm a mentor looking for a home in Southern California! I know Java, C++, electrical and mechanical.
Need Java or C++ help? Send me a PM!
|