![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Mini Project 10: Displaying stuff from day 7
Dependencies: DmTouch_UniGraphic UniGraphic mbed
Diff: acceler_sensor.cpp
- Revision:
- 7:ee7f2c33d45d
- Parent:
- 6:b196b0a8f337
- Child:
- 8:bbe3e332fe94
--- a/acceler_sensor.cpp Tue Jan 17 19:12:33 2017 +0000 +++ b/acceler_sensor.cpp Tue Jan 17 19:16:38 2017 +0000 @@ -11,6 +11,7 @@ i2c_port.stop(); wait(0.01); + i2c_port.start(); i2c_port.write(address); i2c_port.write(0x21);//set Tap Duration @@ -60,25 +61,5 @@ i2c_port.write(0x08);//measure mode i2c_port.stop(); wait(0.01); -} - -void getacceleration (void){ - char buffer[6]; - int16_t rawdata[3]; - /*acc.write(0x80|0x40|0x32); - for(int i=0; i<= 5; i++) - { - buffer[i]=12c.write(0x00); - //pc.printf("x = %+1.2fg\t", buffer[i]); - } - cs=1; - rawdata[0] = buffer[1]<<8 | buffer[0]; - rawdata[1] = buffer[3]<<8 | buffer[2]; - rawdata[2] = buffer[5]<<8 | buffer[4]; - data[0] = rawdata[0]; - data[1] = rawdata[1]; - float x = data[0]; - float y = data[1]; - pc.printf("x = %+1.2fg\t y = %+1.2fg\n\r", rawdata[0],rawdata[1]); Just grabbed from SPI code. Not formatted right*/ - - } \ No newline at end of file + +} \ No newline at end of file