|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
A quick question
I know i should post this in the techinical but i need an answer now. Here is my question
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 |
| Quick <hr> question | Jack | Website Design/Showcase | 1 | 31-01-2003 22:19 |
| Quick Optical Sensor Question | zorro | Technical Discussion | 10 | 21-01-2003 06:39 |
| To all the ladies in the hiz-ous!! lol a quick question | archiver | 2001 | 1 | 24-06-2002 02:12 |
| Quick Question | archiver | 2001 | 5 | 24-06-2002 00:08 |
| Quick Question, i guess | Andrew Rudolph | Motors | 1 | 12-08-2001 14:39 |