a funy bracelet
Dependencies: ADXL345_I2C PololuLedStrip USBDevice mbed
Fork of xadow_m0_accelerometer by
Revision 0:b017c907d53d, committed 2014-06-18
- Comitter:
- seeed
- Date:
- Wed Jun 18 11:03:59 2014 +0000
- Child:
- 1:daff562098ac
- Commit message:
- initial
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ADXL345_I2C.lib Wed Jun 18 11:03:59 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Strikewolf/code/ADXL345_I2C/#a7184ee0a913
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Wed Jun 18 11:03:59 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/USBDevice/#0c6524151939
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jun 18 11:03:59 2014 +0000
@@ -0,0 +1,41 @@
+#include "ADXL345_I2C.h"
+
+#define DEBUG
+
+#ifdef DEBUG
+#include "USBSerial.h" // To use USB virtual serial, a driver is needed, check http://mbed.org/handbook/USBSerial
+#define LOG(args...) pc.printf(args)
+USBSerial pc;
+#else
+#define LOG(args...)
+#endif
+
+ADXL345_I2C accelerometer(P0_5, P0_4);
+
+int main()
+{
+ int readings[3] = {0, 0, 0};
+
+ LOG("Starting ADXL345 test...\n");
+ LOG("Device ID is: 0x%02x\n", accelerometer.getDeviceID());
+
+ //Go into standby mode to configure the device.
+ accelerometer.setPowerControl(0x00);
+
+ //Full resolution, +/-16g, 4mg/LSB.
+ accelerometer.setDataFormatControl(0x0B);
+
+ //3.2kHz data rate.
+ accelerometer.setDataRate(ADXL345_3200HZ);
+
+ //Measurement mode.
+ accelerometer.setPowerControl(0x08);
+
+ while (1) {
+ accelerometer.getOutput(readings);
+ LOG("%i, %i, %i\n", (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]);
+
+ wait(1);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 18 11:03:59 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721 \ No newline at end of file
