Hey I need a little help. I’ve worked a little bit with PBasic but whenever I try and write a code for what I’m doing it doesn’t seem to work. I was just wondering if anyone could lend me his or her idea on how to generate the code. What I want to do is when you, for example, hit the trigger button on joystick 1 it performs an operation of opening and closing two different switches which would control a set of cylinders. I would like one button to cause a set of cylinders to close an arm and then cause a different set on relay 2 to push them up. In reality control two relays on one joystick button, which intern causes one to open and then the other to in a set of steps. If any one could please lend me some idea of an operation to do this it would be very much appreciated.
Is this for something like the variable-extension cylinder somebody asked about in the pneumatics forum? Or is it something else?
Anyways, from what I can understand, you want to press a button and then have two events occur with some time between them, right? If so, take a look at CogCode2k2, available at my website, http://www.robbayer.com/software.html. Last year, we had a system where you pushed a button on the joystick, the robot stopped for a second, the gear shifted for a second, and then the robot started moving again. With some minor modifications you can probably make it work for your application as it is the same basic concept. If you need help with the mods, email/PM me.
Because your program must loop repeatedly, you will have to store, in a variable or in the extra RAM, a number that will tell you what state your program should be in.
For example, the first time it detects the button, it would start moving the arm, and store a value so that the next time your program goes through the loop, it will do the next operation (or wait a few loops first). I think the RC is designed to loop about 25 times/sec. You can’t pause during a loop to wait for your arm to close or something, or you will start dropping packets and wind up with an error, most likely.
Hope this helps.