Go to Post But their robot puts its wheels on one at a time just like ours, so we can be a HOF winner too! - Foster [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-01-2008, 13:41
kE7JLM's Avatar
kE7JLM kE7JLM is offline
KE7JLM `
AKA: John Harris
FRC #0842 (Falcon Robotics)
Team Role: Driver
 
Join Date: May 2007
Rookie Year: 2006
Location: Phoenix, AZ`
Posts: 136
kE7JLM is a name known to allkE7JLM is a name known to allkE7JLM is a name known to allkE7JLM is a name known to allkE7JLM is a name known to allkE7JLM is a name known to all
Send a message via MSN to kE7JLM
Pressure Switch code

I am having a problem with our compressor, spikes, and RC. I need to get the pressure switch to tell the spike that is connected to the compressor to turn on unto it read 120psi. Yet I don't even have a spike switching to fwd or rev?

I have this code in right now

if(digital_io_18 == 0)
{
relay1_fwd == 1;
}

if(digital_io_18 ==1)
{
relay1_fwd == 0;
}


Can some let me know what I am doing wrong?

Thank you
__________________
Team 842 Programmer

Pictures at:
http://picasaweb.google.com/KE7JLM
&
http://picasaweb.google.com/john.h.842

Videos -
http://www.youtube.com/user/KE7JLM

When your not busy with FIRST try NURC

  #2   Spotlight this post!  
Unread 25-01-2008, 13:54
slickwill1675 slickwill1675 is offline
Registered User
FRC #0247
 
Join Date: Jan 2008
Location: Berkley, MI
Posts: 4
slickwill1675 is an unknown quantity at this point
Re: Pressure Switch code

Your if statements match mine but I think it should be relay1_fwd = 1; not relay1_fwd == 1;

== is for comparing, = is for assigning values

If thats not it, double check that you have the digital i/o set to input. Also check that your code is actually being called. I had my code in user_routines.c/default_routine() which wasn't being called, once i stuck the code in user_routines.c/Process_Data_From_Master_uP() it worked. Also make sure your not in disabled mode. I made the that mistake earlier this week

user_routines.c/User_Initialization()
digital_io_18 = INPUT; //DIGITAL I/O set to input;

Good luck
  #3   Spotlight this post!  
Unread 25-01-2008, 14:45
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Pressure Switch code

Along with the == vs = confusion, you're reading the wrong thing to test the pressure switch. Writing to digital_io_18 is for configuring the pin as either an input or an output. You want read from rc_dig_in18, which gives you the value of the pin.
  #4   Spotlight this post!  
Unread 25-01-2008, 14:54
Robostang 548's Avatar
Robostang 548 Robostang 548 is offline
I can program the future...
AKA: Don
FRC #0548 (Robostangs)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Northville Mi
Posts: 69
Robostang 548 is on a distinguished road
Send a message via AIM to Robostang 548 Send a message via MSN to Robostang 548 Send a message via Yahoo to Robostang 548
Re: Pressure Switch code

You can just do it all in one line.

Code:
relay1_fwd=!rc_dig_in18
-Don
__________________

Team 548:
Attending National Championship, Genesee District, Detroit District 2, West Michigan District, Michigan Championship?


Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRESSURE SWITCH Mr. Steve Pneumatics 20 01-12-2005 10:20
Pressure switch code kingpin3787 General Forum 11 22-02-2004 21:52
HELP US PLEASE?!?!(pressure switch code) kingpin3787 General Forum 1 21-02-2004 15:13
pressure switch Michael Long Pneumatics 1 11-02-2003 11:21
pressure switch Antonio Pneumatics 10 31-01-2003 03:52


All times are GMT -5. The time now is 09:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi