View Single Post
  #3   Spotlight this post!  
Unread 12-01-2007, 11:27
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Need Help With General Pneumatics

Also, to make pneumatics programming easier, I've whipped up a quick set of macros you can use in your project to control the relays.

Changing a relay's state requires you to set a 0 to one variable and a 1 to another, if you forget, they jam, not such a good thing, these macro's will automate the process a bit and neaten up your code.

Example of the old way:
Code:
	relay1_fwd = 1; // This sets relay 1
	relay1_rev = 0; // to forward

	relay2_fwd = 0; // This sets relay 2
	relay2_rev = 1; // to reverse

	relay3_fwd = 1; // This makes relay 3
	relay3_rev = 1; // get stuck!

	relay4_fwd = 0; // This sets relay 4
	relay4_rev = 0; // to off
Example of my way:
Code:
	RELAY1_FWD; // This sets relay 1 to forward

	RELAY2_REV; // This sets relay 2 to reverse

	// No way to get stuck!
	
	RELAY4_OFF; // This sets relay 4 to off
All you need to do is add
Code:
        #include "relays.h"
at the top of whatever file uses these macros, and that file is attached to this post: http://www.chiefdelphi.com/forums/sh...507#post455507

Good luck!
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)