Go to Post edit: laptop. yeah as a programmer to not put this in I should be taken out the back and "decompiled". - Stuart [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
  #1   Spotlight this post!  
Unread 02-06-2015, 09:20 PM
Brindlefly's Avatar
Brindlefly Brindlefly is offline
Registered User
AKA: Jake Kinsella
FRC #4761 (Robockets)
Team Role: Leadership
 
Join Date: Nov 2014
Rookie Year: 2014
Location: Reading, MA
Posts: 8
Brindlefly will become famous soon enough
Help! Why Can't I Read Gyro Values Over the I2C Interface!

We bought a MPU 6050 gyro/accelerometer from Sparkfun Electronics. The spec sheet says the I2C address is 0x68 and that the WhoAmI register is at adress 075. When we read from that address we get the expected output of 104 decimal (0x68). When we tried to read the gyro register, at 0x43 - 0x47, we only get zeros. When we try to read the temperature register, we also get zeros. Is there something we have to do to enable reporting of the values?

Code:
private I2C gyro = new I2C(I2C.Port.kOnboard, 0x68);
	
	protected void initialize () {
		gyro.write(0x6B, 0x80);
	}
	
	protected void execute () {
		byte[] whoAmI = new byte[1];
		gyro.read(0x75, 1, whoAmI);
		System.out.println("WhoAmI: " + whoAmI[0]);
		
		for (int i = 0x43; i <= 0x47; i += 0x02) {
			byte[] angle = new byte[2];
			gyro.read(i, 2, angle);
		
			System.out.println(i + ": " + angle[0] + "" + angle[1]);
		}
	}
	
	protected boolean isFinished () {
		return false;
	}
	
	protected void end () {
		
	}
	
	protected void interrupted () {
		end();
	}
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 07:54 AM.

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