|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
We are trying to extend and retract a cylinder with a button push. We've already made it work well with two different buttons, but now we're just trying to make the joystick more user-friendly. We have all programmed in C++ and Turing languages, and have tried to incorporate that type of logic in our programs, but have failed miserably. For example, logically one would think that "p1_sw_top = 1" means that the button is pressed, but we have found that it is actually "p1_sw_top = 0". Does Basic not allow If statements inside other If statements?
This is part of the program, and we want to know what part doesn't work. We have declared count1 and assigned a value of 1 to it at the beginning of the program, outside the main loop. if p1_sw_top = 0 then turn: if count1=1 then left: relay1_fwd = 0 relay1_rev = 1 count1 = 2 left: if count1=2 then right: relay1_fwd = 1 relay1_rev = 0 count1 = 1 right: turn: Another example program that we have tried is : 'if ((p1_sw_top = 0) &~ (count1=2))then turn: ' relay1_fwd = 1 ' relay1_rev = 0 ' count1 = 2 'turn: 'if (p1_sw_top = 0) & (count1 = 2) then turn1: ' relay1_fwd = 1 ' relay1_rev = 0 ' count1 = 1 'turn1: For some reason, the controller doesn't wait for a button to be pressed, it just sees "count1 = 1," and extends. Any help and/or suggestions would be greatly appreciated. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C controller | Rorschach | Kit & Additional Hardware | 1 | 29-10-2003 19:21 |
| New Controller Specs Posted | Jnadke | Programming | 58 | 05-10-2003 08:18 |
| serious problem found - robot controller resets when jarred! | KenWittlief | Electrical | 23 | 19-03-2003 13:30 |
| Hooking up Controller to computer for programming. | Dragon45 | General Forum | 3 | 30-01-2003 00:22 |
| Error found in programming for the pump and pressure switch | sjharobotics | Programming | 4 | 06-02-2002 17:46 |