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.
Diff: detectorimpacto.hh
- Revision:
- 20:159d9bab43fc
- Parent:
- 9:c217aed1ac8a
diff -r db88112ab2b6 -r 159d9bab43fc detectorimpacto.hh
--- a/detectorimpacto.hh Wed Feb 10 20:02:46 2016 +0000
+++ b/detectorimpacto.hh Fri Feb 12 13:34:50 2016 +0000
@@ -1,11 +1,29 @@
-#ifndef detectorimpacto
-#define detectorimpacto
+#include "mbed.h"
+#include "MMA8451Q.h"
+
+Serial s0(USBTX, USBRX);
+MMA8451Q acc(PTE25, PTE24);
+PwmOut rled(LED_BLUE);
+PwmOut gled(LED_GREEN);
+PwmOut bled(LED_RED);
+int16_t data[3];
-#include " mbed.h"
-void detectorimpacto_mensaje(){
- DigitalOut Do1(D0);
- Do1=1;
+int main()
+{
+ s0.baud(9600);
+ s0.format(8,SerialBase::None,1);
+ s0.putc(65);
+
+ while(1)
+ {
+ acc.getAccAllAxis(data);
+ s0.printf("%d,\t%d,\t%d\n", data[0], data[1], data[2]);//
+ rled = 1.0- abs(data[0]/1600.0);
+ gled = 1.0- abs(data[1]/1200.0);
+ bled = 1.0- abs(data[2]/1300.0);
+ wait(0.1);
+ }
+}
}
-#endif
\ No newline at end of file
