PARTYYYY

Dependencies:   mbed MMA8452

Committer:
evrast
Date:
Mon Sep 04 19:51:12 2017 +0000
Revision:
0:c2282db9d19e
Child:
2:3576839565ae
Child:
3:56cd9dff3b5f
App1 partyyyyy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
evrast 0:c2282db9d19e 1 #include "Accelerometre.h"
evrast 0:c2282db9d19e 2
evrast 0:c2282db9d19e 3
evrast 0:c2282db9d19e 4
evrast 0:c2282db9d19e 5
evrast 0:c2282db9d19e 6 int Accelerometre::readSingleByte(int regis){
evrast 0:c2282db9d19e 7 char cmd[8];
evrast 0:c2282db9d19e 8 int c;
evrast 0:c2282db9d19e 9 pc.printf("Reading single byte\n");
evrast 0:c2282db9d19e 10 i2c.start();
evrast 0:c2282db9d19e 11 int a=i2c.write(0x38); // A write to device
evrast 0:c2282db9d19e 12 i2c.write(regis); // Register to read from (acceleration in X)
evrast 0:c2282db9d19e 13 i2c.start(); // Need to send start condition here
evrast 0:c2282db9d19e 14 i2c.write(0x39); // tell devide you want to read
evrast 0:c2282db9d19e 15 c=i2c.read(0);
evrast 0:c2282db9d19e 16 i2c.stop();
evrast 0:c2282db9d19e 17 pc.printf("value is %d\n", c);
evrast 0:c2282db9d19e 18 pc.printf("end\n");
evrast 0:c2282db9d19e 19 return c;
evrast 0:c2282db9d19e 20 }