View Single Post
  #5   Spotlight this post!  
Unread 02-02-2004, 21:15
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: using single solenoid like a double

if you mean you want to use two buttons like "on" and "off" buttons, here's one way to do it:

Code:
static char btn_status = 0;

if(p1_sw_aux1) btn_status = 1;
if(p1_sw_aux2) btn_status = 0;

relay1_fwd = btn_status;
basically, just declare a static variable (so that it holds its state), then use the input from the buttons to set the variable at the appropriate times. (note - some of the input variable names may be off, i'm doing this from memory only)
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)