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.
Fork of Activity by
Activity.cpp@1:c30afef67c43, 2018-03-07 (annotated)
- Committer:
- jcaro
- Date:
- Wed Mar 07 13:37:22 2018 +0000
- Revision:
- 1:c30afef67c43
- Parent:
- 0:f8b83c4ca41c
Class Activity
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jcaro | 1:c30afef67c43 | 1 | #include "mbed.h" |
| jcaro | 0:f8b83c4ca41c | 2 | #include "Activity.h" |
| jcaro | 0:f8b83c4ca41c | 3 | #include <iostream> |
| jcaro | 0:f8b83c4ca41c | 4 | using namespace std; |
| jcaro | 0:f8b83c4ca41c | 5 | |
| jcaro | 0:f8b83c4ca41c | 6 | Activity::Activity () { |
| jcaro | 0:f8b83c4ca41c | 7 | trasmitido=false; |
| jcaro | 0:f8b83c4ca41c | 8 | } |
| jcaro | 0:f8b83c4ca41c | 9 | |
| jcaro | 0:f8b83c4ca41c | 10 | void Activity::set_values (float a,float b,uint16_t c,float d,float e,float f,float g) { |
| jcaro | 0:f8b83c4ca41c | 11 | startAct = a; |
| jcaro | 0:f8b83c4ca41c | 12 | tAct = b; |
| jcaro | 0:f8b83c4ca41c | 13 | pasos = c; |
| jcaro | 0:f8b83c4ca41c | 14 | cad = d; |
| jcaro | 0:f8b83c4ca41c | 15 | medS = e; |
| jcaro | 0:f8b83c4ca41c | 16 | medNS = f; |
| jcaro | 0:f8b83c4ca41c | 17 | sim = g; |
| jcaro | 0:f8b83c4ca41c | 18 | } |
| jcaro | 0:f8b83c4ca41c | 19 | |
| jcaro | 0:f8b83c4ca41c | 20 | void Activity::trasmision (){ |
| jcaro | 0:f8b83c4ca41c | 21 | trasmitido = true; |
| jcaro | 0:f8b83c4ca41c | 22 | } |
| jcaro | 0:f8b83c4ca41c | 23 | |
| jcaro | 0:f8b83c4ca41c | 24 | bool Activity::get_trasmitido(){ |
| jcaro | 0:f8b83c4ca41c | 25 | return trasmitido; |
| jcaro | 0:f8b83c4ca41c | 26 | } |
| jcaro | 0:f8b83c4ca41c | 27 | |
| jcaro | 0:f8b83c4ca41c | 28 | void Activity::serial(char* ch){ |
| jcaro | 0:f8b83c4ca41c | 29 | |
| jcaro | 0:f8b83c4ca41c | 30 | const unsigned char header[]={0xFF,0xFF,0xFF,0xFF}; |
| jcaro | 0:f8b83c4ca41c | 31 | |
| jcaro | 0:f8b83c4ca41c | 32 | memcpy(ch, &header, sizeof(header)); |
| jcaro | 0:f8b83c4ca41c | 33 | memcpy(&ch[sizeof(header)], &startAct, sizeof(startAct)); |
| jcaro | 0:f8b83c4ca41c | 34 | memcpy(&ch[sizeof(header)+sizeof(startAct)], &tAct, sizeof(tAct)); |
| jcaro | 0:f8b83c4ca41c | 35 | memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)], &pasos, sizeof(pasos)); |
| jcaro | 0:f8b83c4ca41c | 36 | memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)+sizeof(pasos)], &cad, sizeof(cad)); |
| jcaro | 0:f8b83c4ca41c | 37 | memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)+sizeof(pasos)+sizeof(cad)], &medS, sizeof(medS)); |
| jcaro | 0:f8b83c4ca41c | 38 | memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)+sizeof(pasos)+sizeof(cad)+sizeof(medS)], &medNS, sizeof(medNS)); |
| jcaro | 0:f8b83c4ca41c | 39 | memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)+sizeof(pasos)+sizeof(cad)+sizeof(medS)+sizeof(medNS)], &sim, sizeof(sim)); |
| jcaro | 0:f8b83c4ca41c | 40 | trasmitido=false; |
| jcaro | 0:f8b83c4ca41c | 41 | } |
