View Single Post
  #2   Spotlight this post!  
Unread 06-01-2014, 19:07
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,586
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Should this code be working? - Beginner

You are telling the compressor to use Relay 1, and also allocate Relay 1 as an individual relay. You need to make sure they are using different relays. The code will cause an exception if you allocate a relay twice, which will cause the print of output not updated enough repeatedly. If you scroll back to the beginning, you would see the exception message and traceback.

Make sure to pay attention to the constructors you are using. Relay(1,1) allocates Relay 1 on Digital Module 1. Relay(2,1) allocates Relay 1 on Digital Module 2 (which you more then likely don't have). Relay(1,2) allocates Relay 2 on Digital Module 1. Compressor(1,1) allocates a digital input for the pressure switch on digital input 1 and and a relay on relay 1, using the default digital module (1).

The compressor monitors the pressure switch on the digital input that you specify, and only turns on the compressor when the pressure is low. You need the pressure switch connected for the compressor to come on. Additionally, the start method should not be called in a loop. It creates it's own look in a new task. You should move it before the while loop in teleop.
Reply With Quote