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.
detectorimpacto.hh@20:159d9bab43fc, 2016-02-12 (annotated)
- Committer:
- joseortega
- Date:
- Fri Feb 12 13:34:50 2016 +0000
- Revision:
- 20:159d9bab43fc
- Parent:
- 9:c217aed1ac8a
rango de los ejes
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| joseortega | 20:159d9bab43fc | 1 | #include "mbed.h" |
| joseortega | 20:159d9bab43fc | 2 | #include "MMA8451Q.h" |
| joseortega | 20:159d9bab43fc | 3 | |
| joseortega | 20:159d9bab43fc | 4 | Serial s0(USBTX, USBRX); |
| joseortega | 20:159d9bab43fc | 5 | MMA8451Q acc(PTE25, PTE24); |
| joseortega | 20:159d9bab43fc | 6 | PwmOut rled(LED_BLUE); |
| joseortega | 20:159d9bab43fc | 7 | PwmOut gled(LED_GREEN); |
| joseortega | 20:159d9bab43fc | 8 | PwmOut bled(LED_RED); |
| joseortega | 20:159d9bab43fc | 9 | int16_t data[3]; |
| joseortega | 8:5980909a65c0 | 10 | |
| joseortega | 20:159d9bab43fc | 11 | int main() |
| joseortega | 20:159d9bab43fc | 12 | { |
| joseortega | 20:159d9bab43fc | 13 | s0.baud(9600); |
| joseortega | 20:159d9bab43fc | 14 | s0.format(8,SerialBase::None,1); |
| joseortega | 20:159d9bab43fc | 15 | s0.putc(65); |
| joseortega | 20:159d9bab43fc | 16 | |
| joseortega | 20:159d9bab43fc | 17 | while(1) |
| joseortega | 20:159d9bab43fc | 18 | { |
| joseortega | 20:159d9bab43fc | 19 | acc.getAccAllAxis(data); |
| joseortega | 20:159d9bab43fc | 20 | s0.printf("%d,\t%d,\t%d\n", data[0], data[1], data[2]);// |
| joseortega | 20:159d9bab43fc | 21 | rled = 1.0- abs(data[0]/1600.0); |
| joseortega | 20:159d9bab43fc | 22 | gled = 1.0- abs(data[1]/1200.0); |
| joseortega | 20:159d9bab43fc | 23 | bled = 1.0- abs(data[2]/1300.0); |
| joseortega | 20:159d9bab43fc | 24 | wait(0.1); |
| joseortega | 20:159d9bab43fc | 25 | } |
| joseortega | 20:159d9bab43fc | 26 | } |
| joseortega | 8:5980909a65c0 | 27 | |
| joseortega | 8:5980909a65c0 | 28 | |
| joseortega | 8:5980909a65c0 | 29 | } |
