Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:bf43b555301c, committed 2014-06-04
- Comitter:
- quevedo
- Date:
- Wed Jun 04 19:18:25 2014 +0000
- Commit message:
- Accelerometer logger for the FRDM-KL25 board, at a data rate of 800Hz. Please use a serial connection at 921600bps.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Wed Jun 04 19:18:25 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/quevedo/code/MMA8451Q/#7c9ab58f6af3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jun 04 19:18:25 2014 +0000
@@ -0,0 +1,52 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+
+// Defines for sensors I2C
+#define SDA PTE25
+#define SCL PTE24
+#define INT1 PTA14
+
+// Define for LED
+#define LRED PTC7
+
+MMA8451Q acc(SDA, SCL);
+Serial pc(USBTX, USBRX);
+Ticker t; // Periodical timer for reading sensors
+//InterruptIn drdy(INT1);
+DigitalOut myled(LRED);
+
+void newdata() {
+ int16_t accdata[3];
+
+ myled = !myled;
+ // Reads all accelerometer and magnetometer data, and also reads analog from FSR1 and FSR2
+ acc.getAccAllAxis(accdata);
+ // Now we transmit data
+ pc.printf("%d,%d,%d\r\n", accdata[0], accdata[1], accdata[2]);
+}
+
+int main() {
+ char cmd;
+ myled = 1;
+ pc.baud(921600); // 176kbps ou mais
+ //drdy.disable_irq();
+ //drdy.fall(&newdata);
+
+ while(1) {
+ if(pc.readable()) {
+ cmd = pc.getc();
+ if(cmd == '1') {
+ t.attach(&newdata, 0.00125); // 800Hz samples
+ //drdy.enable_irq();
+ } else if(cmd == '0') {
+ t.detach();
+ //drdy.disable_irq();
+ myled = 1;
+ }
+ }
+ }
+}
+
+/*
+
+ */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 04 19:18:25 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7d30d6019079 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nRF24L01P.lib Wed Jun 04 19:18:25 2014 +0000 @@ -0,0 +1,1 @@ +nRF24L01P