title: How to read data from i2c using i2cget?
body: <p>I'm new to embedded devices and am trying to understand how to use i2cget (or the entire I2C protocol really). </p>
  
  <p>I'm using an accelerometer MMA8452, and the datasheet says the Slave Address is 0x1D (if my SAO=1, which I believe is referring to the I2C bus being on channel 1 on my raspberrypi v2). </p>
  
  <p>From the command line, I enter </p>
  
  <pre><code>sudo i2cget -y 1 0X1d
  </code></pre>
  
  <p>It returns</p>
  
  <pre><code>0X00
  </code></pre>
  
  <p>I think that means I'm attached to the correct device. </p>
  
  <p>So now, I'm trying to figure out how do I get actual data back from the accelerometer?</p>
  
  <p>The i2c spec says </p>
  
  <pre><code>i2cget [-y] i2cbus chip-address [data-address [mode]]
  </code></pre>
  
  <p>So I have tried</p>
  
  <pre><code>sudo i2cget -y 1 0x1D 0x01
  </code></pre>
  
  <p>where 0x01 is the OUT_X_MSB. I'm not sure entirely what I'm expecting to get back, but I figured if I saw some data other than 0x00, I might be able to figure that out.</p>
  
  <p>Am I using ic2get wrong? Is there a better way to learn and get data from i2c?</p>
  
  <p>The datasheet for my accelerometer chip is at 
  <a href="http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Accelerometers/MMA8452Q.pdf" rel="nofollow">http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Accelerometers/MMA8452Q.pdf</a></p>