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.
Dependencies: MMA8451Q TSI mbed-src
Fork of KL25Z_BT by
Revision 0:5a3e0b8133dc, committed 2014-02-09
- Comitter:
- jppang
- Date:
- Sun Feb 09 09:10:34 2014 +0000
- Commit message:
- KL25Z with HC-06 Bluetooth module try out
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Sun Feb 09 09:10:34 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/JoKer/code/MMA8451Q/#2d14600116fc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSI.lib Sun Feb 09 09:10:34 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Feb 09 09:10:34 2014 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+#include "TSISensor.h"
+#include "MMA8451Q.h"
+#include <cstdlib>
+#include <iostream>
+
+TSISensor tsi;
+MMA8451Q acc(PTE25, PTE24, 0x1D<<1);
+PwmOut rled(LED_RED);
+PwmOut gled(LED_GREEN);
+PwmOut bled(LED_BLUE);
+DigitalOut testPin(PTC7);
+
+Serial bt(PTC4, PTC3);
+
+int main() {
+ using namespace std;
+
+ float onTime = 1.0;
+// float offTime = 0.0;
+ float holdTime = 1.0;
+// bool on = true;
+ bool off = false;
+ char bt_msg[100] = "";
+
+
+ while(true) {
+
+ rled = onTime - abs(acc.getAccX());
+ gled = onTime - abs(acc.getAccY());
+ bled = onTime - abs(acc.getAccZ());
+ testPin = rand() % 2;
+ cout << "MMA8451Q: " << acc.getAccX() << "\t" << acc.getAccY() << "\t" << acc.getAccZ() << "\n\r" << flush << endl;
+// bt.printf("this is a bluetooth test\n");
+ wait(holdTime);
+
+// if(bt.readable()){
+// bt.putc(bt.getc());
+// }
+ if(bt.readable()){
+ bt.scanf("%s", bt_msg, sizeof(bt_msg));
+ }
+
+ rled = onTime - tsi.readPercentage();
+ gled = onTime - tsi.readPercentage();
+ bled = onTime - tsi.readPercentage();
+ testPin = off;
+ cout << "Touch Sensor: " << tsi.readPercentage() << "\n\r" << flush << endl;
+// bt.printf("this is also a bluetooth test\n");
+ bt.printf("%s\n", bt_msg);
+ wait(holdTime);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-src.lib Sun Feb 09 09:10:34 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-src/#26fc69fd3b6c
