View Single Post
  #4   Spotlight this post!  
Unread 08-04-2014, 14:12
NWChen's Avatar
NWChen NWChen is offline
Alum
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: New York City
Posts: 205
NWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to behold
Re: Using multiple classes in java to control one pwm

Quote:
Originally Posted by vgdude999 View Post
If you declare a talon object in map.java, you can just make new variables in the two other classes that point to the existing object.
Ex:
Talon motor = map.getMotor();
@sthreet: Or this, in which case map.java would have to initialize your Talon objects with the constants, e.g.
Code:
Talon motor = new Motor(PWM_PORT_ON_DSC);
For this purpose you may want to look into the Singleton design pattern. Be careful that multiple classes aren't attempting to access the Talon object at the same time, which appears to be your initial problem.
__________________
2012 - 2015 • Team 2601

Reply With Quote