![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Simple example of Classes
Revision 0:8161780f82c0, committed 2017-09-26
- Comitter:
- zer044
- Date:
- Tue Sep 26 08:44:20 2017 +0000
- Commit message:
- Example of functions with and without classes
Changed in this revision
diff -r 000000000000 -r 8161780f82c0 Class1.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Class1.lib Tue Sep 26 08:44:20 2017 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/zer044/code/Class1/#809707a63c26
diff -r 000000000000 -r 8161780f82c0 FunctionsStuff.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FunctionsStuff.cpp Tue Sep 26 08:44:20 2017 +0000 @@ -0,0 +1,10 @@ +#include "mbed.h" +#include "FastLoop.h" + + +DigitalOut ledy1(p8); + +void setLEDstate(int state) +{ + ledy1.write(state); +} \ No newline at end of file
diff -r 000000000000 -r 8161780f82c0 FunctionsStuff.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FunctionsStuff.h Tue Sep 26 08:44:20 2017 +0000 @@ -0,0 +1,5 @@ + + + +//Include all function headers here +void setLEDstate(int state); \ No newline at end of file
diff -r 000000000000 -r 8161780f82c0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 26 08:44:20 2017 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "FastLoop.h" +#include "AClassy.h" + +DigitalOut myled(LED1); + +int main() { + + ClassyClass Myclass1; + + while(1) { + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + + + setLEDstate(1); + Myclass1.setLEDstate(1); + + + } +}
diff -r 000000000000 -r 8161780f82c0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 26 08:44:20 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/675da3299148 \ No newline at end of file