|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#22
|
|||
|
|||
|
1 Sensor Code
Here is some code that will allow you to use 1 sensor to control your pump if you need to save on weight.
Keep in mind, if you keep your executable code length short, your serin and serout commands will occur more frequently making your robot respond quicker to inputs and outputs. Also, debug commands slow down the code execution. Comment them out after you're done with testing. If you want proof, watch the Basic Run light when the debug code is in the program and when it is out. That LED is controlled by: Toggle 7 'Basic Run LED on the RC is toggled ON/OFF every loop. in the default program. Everytime the code is executed, the LED is toggled. The faster it blinks. The faster your code is executing. Sorry to go off the topic. Below is the code: I tested it in RoboEmu 1.07 ------------------------------------------------------------------ ' Variables Counter VAR w10 LowPres VAR rc_swA.bit1 PumpMan VAR oi_swA.bit2 'Aux input, Pump VAR RelayA.bit0 Pump_rev VAR RelayA.bit1 Counterbit VAR Counter.bit0 CounterMax CON 501 'This number needs to be odd Counter = CounterMax MainProgram: Serin... 'Pump Code for 1 sensor LowPres = ~LowPres Counter = ((LowPres) * (Counter + 2)) max CounterMax LowPres = ~LowPres Pump = ((LowPres | ~Counterbit) & ~PumpMan) Pump_rev = 0 Serout... ---------------------------------------------------------------- |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Does your team use the Default code. | Jeff McCune | General Forum | 2 | 09-01-2003 14:46 |
| What are pneumatics? | Aignam | Pneumatics | 23 | 16-10-2002 21:17 |
| Need help with 255 Variable | Joseph F | Programming | 18 | 26-02-2002 14:49 |
| Error found in programming for the pump and pressure switch | sjharobotics | Programming | 4 | 06-02-2002 17:46 |
| Pneumatics pump allowed on robot? | bigqueue | Pneumatics | 5 | 06-01-2002 12:30 |