View Single Post
  #7   Spotlight this post!  
Unread 31-01-2016, 18:24
JacobD's Avatar
JacobD JacobD is offline
Registered User
AKA: Jacob
FRC #1672 (Mahwah Robo T-Birds)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2013
Location: New Jersey
Posts: 90
JacobD is an unknown quantity at this point
Re: [Vision] Multithreading?

Code:
Thread cameraThread = new Thread()
{
	public void run()
	{
		//camera code goes here
	}
};
Then do...
Code:
cameraThread.sleep(timeInMillis);
or

Code:
cameraThread.stop(); //not sure if this is depreciated

java.util.Timer myTimer = new java.util.Timer();

myTimer.schedule(new TimerTask() 
{
       @Override
	public void run()
	{
		 cameraThread.run();
	}
}, 1000);
The difference between this and sleeping the thread is that the timer doesn't suspend the run-time of the program. I'm thinking that this is what you are looking for.
__________________
2013-2014: Electrical, Mechanical
2014-2017: Team Captain

Last edited by JacobD : 31-01-2016 at 18:27.
Reply With Quote