![](/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
--- /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
--- /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
--- /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
--- /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); + + + } +}
--- /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