![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
a cool bubble game
Dependencies: DmTouch_UniGraphic UniGraphic mbed
Fork of DAY_8_miniproject by
accel_sensor.cpp
- Committer:
- ezimmerman17
- Date:
- 2017-01-12
- Revision:
- 2:b0e371e6bbfe
- Parent:
- 1:7a145a5af9cd
File content as of revision 2:b0e371e6bbfe:
#include "accel_sensor.h" void acceleration_n(void){ cs=1; acc.format(8,3); acc.frequency(2000000); cs=0; acc.write(0x31); acc.write(0x0B); cs=1; cs=0; acc.write(0x2D); acc.write(0x08); cs=1; while(1){ wait(0.2); cs=0; acc.write(0x80|0x40|0x32); for (int i = 0; i <=5;i++){ buffer[i]=acc.write(0x00)); } cs=1; data[0]=buffer[1]<<8|buffer[0]; data[1]=buffer[3]<<8|buffer[2]; x=0.004*data[0]; y=0.004*data[1]; } }