View Single Post
  #4   Spotlight this post!  
Unread 26-01-2017, 08:17
SamCarlberg's Avatar
SamCarlberg SamCarlberg is offline
GRIP, WPILib. 2084 alum
FRC #2084
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 154
SamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to behold
Re: Cannot program two ultrasonic sensors. Please help us!

You're creating new sensors every time you create new Ultra1 or Ultra 2 commands. That's what's causing the problem.

With WPILib, it's assumed that your sensors don't change during a match so whenever you create a new sensor, it will check if another sensor object has already used those channels. Your sensor variables should be in the appropriate subsystems. Look at the GearsBot example program in Eclipse to see how you should structure your code
__________________
WPILib
GRIP, RobotBuilder
Reply With Quote