View Single Post
  #2   Spotlight this post!  
Unread 01-05-2008, 18:58
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: I need some help with programming the Pneumatics

I'll let someone else help with the EasyC syntax, but I'll at least give you some insight that might allow you to help yourself.

Think about what you want to do in plain English.

Code:
If the port 1 trigger button is pressed, set relay 1 to on...otherwise (else) set relay 1 to off

If the port 1 top button is pressed, set relay 2 to on...otherwise (else) set relay 2 to off

If the port 1 aux1 button is pressed, set relay 3 to on...otherwise (else) set relay 3 to off
There are two values that you can set in order to set the state of a relay, forward and reverse. This table should help you determine what you need to do to get the desired result
Code:
Fwd = 0 Rev = 0 - OFF (orange)
Fwd = 0 Rev = 1 - Reverse (red)
Fwd = 1 Rev = 0 - Forward (green)
Fwd = 1 Rev = 1 - OFF (orange)
So what blocks in EasyC correspond with the description above? Well, there's probably an If/Else block and there's probably a relay out block. Think through it, and experiment a bit. I'm sure that if you try it you'll figure it out. I would suggest not connecting the outputs of the relays and using the LED on the spike as feedback on whether your code is working or not. This will protect you from accidental misfires.