Interrupt
Dependencies: BLE_API BLE_Driver I2C_Driver MAX30100 PROCESAMIENTO_DATOS_SP02 mbed nRF51822 millis
Fork of MAX30100_FirstTry by
mainbletest.cpp@0:882170680817, 2016-08-22 (annotated)
- Committer:
- Ferszt
- Date:
- Mon Aug 22 01:04:43 2016 +0000
- Revision:
- 0:882170680817
- Child:
- 1:33d65d13c46a
BLE Lib test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ferszt | 0:882170680817 | 1 | #include "mbed.h" |
Ferszt | 0:882170680817 | 2 | #include "BLE_Driver.h" |
Ferszt | 0:882170680817 | 3 | |
Ferszt | 0:882170680817 | 4 | DigitalOut LIVE_LED(LED1, 1); |
Ferszt | 0:882170680817 | 5 | DigitalOut CONECT_LED(LED2, 1); |
Ferszt | 0:882170680817 | 6 | DigitalOut TEST_LED(LED3, 1); |
Ferszt | 0:882170680817 | 7 | DigitalIn TEST_BUTTON(p17,PullUp); |
Ferszt | 0:882170680817 | 8 | |
Ferszt | 0:882170680817 | 9 | void callbackBLE(int event) { |
Ferszt | 0:882170680817 | 10 | switch (event){ |
Ferszt | 0:882170680817 | 11 | case 1: CONECT_LED = 0; break; |
Ferszt | 0:882170680817 | 12 | case 2: CONECT_LED = 1; break; |
Ferszt | 0:882170680817 | 13 | default: break; |
Ferszt | 0:882170680817 | 14 | } |
Ferszt | 0:882170680817 | 15 | } |
Ferszt | 0:882170680817 | 16 | |
Ferszt | 0:882170680817 | 17 | void periodicCallback(void){ |
Ferszt | 0:882170680817 | 18 | LIVE_LED =! LIVE_LED; |
Ferszt | 0:882170680817 | 19 | uint8_t a; |
Ferszt | 0:882170680817 | 20 | a= getBLE(); |
Ferszt | 0:882170680817 | 21 | if (a=='G') |
Ferszt | 0:882170680817 | 22 | TEST_LED = !TEST_LED; |
Ferszt | 0:882170680817 | 23 | } |
Ferszt | 0:882170680817 | 24 | |
Ferszt | 0:882170680817 | 25 | int main(void){ |
Ferszt | 0:882170680817 | 26 | Ticker Flasher; |
Ferszt | 0:882170680817 | 27 | Flasher.attach(periodicCallback, 1); |
Ferszt | 0:882170680817 | 28 | iniBLE("Sigfried"); |
Ferszt | 0:882170680817 | 29 | while(1){ |
Ferszt | 0:882170680817 | 30 | if (TEST_BUTTON == 0) |
Ferszt | 0:882170680817 | 31 | putBLE("Hola\n\r"); |
Ferszt | 0:882170680817 | 32 | } |
Ferszt | 0:882170680817 | 33 | } |
Ferszt | 0:882170680817 | 34 |