Thiago .
/
AprendendoClasses
Creating an array of Classes
Revision 0:978160d93f83, committed 2015-08-05
- Comitter:
- Jamess
- Date:
- Wed Aug 05 13:41:30 2015 +0000
- Commit message:
- Criando array de classes;
Changed in this revision
diff -r 000000000000 -r 978160d93f83 Signal.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Signal.cpp Wed Aug 05 13:41:30 2015 +0000 @@ -0,0 +1,13 @@ +#include "Signal.h" + +uint32_t Signal::getValue(void){ + + return Value; + + } + +void Signal::setValue(uint32_t a){ + + Value = a; + + } \ No newline at end of file
diff -r 000000000000 -r 978160d93f83 Signal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Signal.h Wed Aug 05 13:41:30 2015 +0000 @@ -0,0 +1,15 @@ +#ifndef SIGNAL_H +#define SIGNAL_H + +#include"mbed.h" + +class Signal{ + + private: + uint32_t Value; + public: + void setValue(uint32_t); + uint32_t getValue(void); +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r 978160d93f83 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 05 13:41:30 2015 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" +#include "Signal.h" + +Serial pc(USBTX,USBRX); + +int main() { + + Signal Acc[10]; + + for(int x=0;x<10;x++){ + + Acc[x].setValue(x); + + } + + for(int y=0;y<10;y++){ + + pc.printf("%i",Acc[y].getValue()); + + } + +}
diff -r 000000000000 -r 978160d93f83 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Aug 05 13:41:30 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/bad568076d81 \ No newline at end of file