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: mbed
Diff: main.cpp
- Revision:
- 6:27a323008a53
- Parent:
- 5:b58e5d191b17
- Child:
- 7:76f16051b775
diff -r b58e5d191b17 -r 27a323008a53 main.cpp
--- a/main.cpp Thu Apr 30 15:49:56 2015 +0000
+++ b/main.cpp Thu Apr 30 16:38:37 2015 +0000
@@ -57,9 +57,8 @@
/*------------BUFFER TO STORE DATA------------------*/
-int buffer_16[4] = {0,0,0,0};
-char buffer_8[8] = {0,0,0,0,0,0,0,0};
-
+uint16_t buffer_16[4] = {0,0,0,0};
+uint8_t buffer_8[8] = {0,0,0,0,0,0,0,0};
int main() {
@@ -89,20 +88,24 @@
buffer_16[PPG] = Ppg.read_u16();
//Divides de buffer 16 into multiple buffers;
+//Falta rotacionar:
+//Ver Ser a rotação está correta
buffer_8[LSB_ECG1] = (buffer_16[ECG1]&&0x0F);
- buffer_8[MSB_ECG1] = (buffer_16[ECG1]&&0xF);
+ buffer_8[MSB_ECG1] = ((buffer_16[ECG1]&&0xF)>>8);
buffer_8[LSB_ECG2] = (buffer_16[ECG2]&&0x0F);
- buffer_8[LSB_ECG2] = (buffer_16[ECG2]&&0xF);
+ buffer_8[LSB_ECG2] = ((buffer_16[ECG2]&&0xF)>>8);
buffer_8[LSB_RESP] = (buffer_16[RESP]&&0x0F);
- buffer_8[MSB_RESP] = (buffer_16[RESP]&&0xF);
+ buffer_8[MSB_RESP] = ((buffer_16[RESP]&&0xF)>>8);
buffer_8[LSB_PPG] = (buffer_16[PPG]&&0x0F);
- buffer_8[MSB_PPG] = (buffer_16[PPG]&&0xF);
+ buffer_8[MSB_PPG] = ((buffer_16[PPG]&&0xF)>>8);
//Sends to the computer
+ pc.printf("%i,%i,%i,%i\n",buffer_16[ECG1],buffer_16[ECG2],buffer_16[RESP],buffer_16[PPG]);//PUTC
+
for (int j = 0;j<8;j++){
pc.putc(buffer_8[j]);
}