Go to Post The answer doesn't lie with an all student run team, or an Engineer-fest team... But somewhere in the middle. Moderation is key. - Cody Carey [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 30-01-2017, 02:48
TakeItEasy TakeItEasy is offline
Registered User
FRC #3034
 
Join Date: Jan 2017
Location: Israel
Posts: 2
TakeItEasy is an unknown quantity at this point
Re: accelerometer return acceleration 0

Quote:
Originally Posted by acastagna View Post
Post your code
Code:
public class Robot extends IterativeRobot {
	RobotDrive myRobot;
	Joystick joystick;
	ADXL362  acc;
	CANTalon[] drive = new CANTalon[4];
	
	@Override
	public void robotInit() 
	{
		for(int i = 1; i < 5; i++)drive[i-1] = new CANTalon(i);
		myRobot = new RobotDrive(drive[2],drive[0]);
		joystick = new Joystick(0);
		acc = new ADXL362(Accelerometer.Range.k4G);
	}

	@Override
	public void autonomousInit() {
		
	}

	@Override
	public void autonomousPeriodic() {

	}

	@Override
	public void teleopInit() {
	}

	@Override
	public void teleopPeriodic() {
		myRobot.arcadeDrive(joystick);
		if(acc.getX() != 0)System.out.println("X " + acc.getX());
		if(acc.getY() != 0)System.out.println("Y " + acc.getY());
		if(acc.getZ() != 0)System.out.println("Z " + acc.getZ());
	}

	@Override
	public void testPeriodic() {
		LiveWindow.run();
	}
}
i tried this code for testing but it doesnt print anything.
Reply With Quote
 


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


All times are GMT -5. The time now is 21:34.

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