![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
this is the library of the code of the second laboration.
Dependencies: SILABS_RHT mbed MemoryLCD
lb123.h@0:33ae04d01fd6, 2020-09-04 (annotated)
- Committer:
- mara1802
- Date:
- Fri Sep 04 11:39:49 2020 +0000
- Revision:
- 0:33ae04d01fd6
lab2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mara1802 | 0:33ae04d01fd6 | 1 | #ifndef MAIN_H |
mara1802 | 0:33ae04d01fd6 | 2 | #define MAIN_H |
mara1802 | 0:33ae04d01fd6 | 3 | #include "mbed.h" |
mara1802 | 0:33ae04d01fd6 | 4 | /** led class. |
mara1802 | 0:33ae04d01fd6 | 5 | A collection of functions created for lab 2 in the course ET095G |
mara1802 | 0:33ae04d01fd6 | 6 | * Mahmood Rahimi och Alia Jabar. |
mara1802 | 0:33ae04d01fd6 | 7 | |
mara1802 | 0:33ae04d01fd6 | 8 | To use this library, its header file needs to be included and an object of the led class created.. |
mara1802 | 0:33ae04d01fd6 | 9 | * |
mara1802 | 0:33ae04d01fd6 | 10 | * Example: |
mara1802 | 0:33ae04d01fd6 | 11 | * @code |
mara1802 | 0:33ae04d01fd6 | 12 | * #include "mbed.h" |
mara1802 | 0:33ae04d01fd6 | 13 | * #include "lb123.h" |
mara1802 | 0:33ae04d01fd6 | 14 | * |
mara1802 | 0:33ae04d01fd6 | 15 | * my led; |
mara1802 | 0:33ae04d01fd6 | 16 | * |
mara1802 | 0:33ae04d01fd6 | 17 | * int main() { |
mara1802 | 0:33ae04d01fd6 | 18 | * @endcode |
mara1802 | 0:33ae04d01fd6 | 19 | */ |
mara1802 | 0:33ae04d01fd6 | 20 | class led |
mara1802 | 0:33ae04d01fd6 | 21 | { |
mara1802 | 0:33ae04d01fd6 | 22 | public: |
mara1802 | 0:33ae04d01fd6 | 23 | /** The constructor creates an instance of the led class. It is automatically called when a new object is declared. |
mara1802 | 0:33ae04d01fd6 | 24 | */ |
mara1802 | 0:33ae04d01fd6 | 25 | led(); |
mara1802 | 0:33ae04d01fd6 | 26 | |
mara1802 | 0:33ae04d01fd6 | 27 | /** Det är funktion för slå på led0. |
mara1802 | 0:33ae04d01fd6 | 28 | */ |
mara1802 | 0:33ae04d01fd6 | 29 | void led::on_led0(); |
mara1802 | 0:33ae04d01fd6 | 30 | |
mara1802 | 0:33ae04d01fd6 | 31 | /** det är funktion för slå på led1. |
mara1802 | 0:33ae04d01fd6 | 32 | */ |
mara1802 | 0:33ae04d01fd6 | 33 | void led::on_led1(); |
mara1802 | 0:33ae04d01fd6 | 34 | |
mara1802 | 0:33ae04d01fd6 | 35 | /** Det är funktion för slå off led0. |
mara1802 | 0:33ae04d01fd6 | 36 | */ |
mara1802 | 0:33ae04d01fd6 | 37 | void led::off_led0(); |
mara1802 | 0:33ae04d01fd6 | 38 | |
mara1802 | 0:33ae04d01fd6 | 39 | /** Det är funktion för slå off led1. |
mara1802 | 0:33ae04d01fd6 | 40 | */ |
mara1802 | 0:33ae04d01fd6 | 41 | void led::off_led1(); |
mara1802 | 0:33ae04d01fd6 | 42 | |
mara1802 | 0:33ae04d01fd6 | 43 | /** This function inverts the state of led0, so off becomes on and on becomes off. |
mara1802 | 0:33ae04d01fd6 | 44 | */ |
mara1802 | 0:33ae04d01fd6 | 45 | void led::toggle_led0(); |
mara1802 | 0:33ae04d01fd6 | 46 | |
mara1802 | 0:33ae04d01fd6 | 47 | /** This function inverts the state of led1, so off becomes on and on becomes off. |
mara1802 | 0:33ae04d01fd6 | 48 | */ |
mara1802 | 0:33ae04d01fd6 | 49 | void led::toggle_led1(); |
mara1802 | 0:33ae04d01fd6 | 50 | |
mara1802 | 0:33ae04d01fd6 | 51 | /** This function blinks led0 once. |
mara1802 | 0:33ae04d01fd6 | 52 | */ |
mara1802 | 0:33ae04d01fd6 | 53 | void led::blink_led0(); |
mara1802 | 0:33ae04d01fd6 | 54 | |
mara1802 | 0:33ae04d01fd6 | 55 | /** This function blinks led1 once. |
mara1802 | 0:33ae04d01fd6 | 56 | */ |
mara1802 | 0:33ae04d01fd6 | 57 | void led::blink_led1(); |
mara1802 | 0:33ae04d01fd6 | 58 | |
mara1802 | 0:33ae04d01fd6 | 59 | |
mara1802 | 0:33ae04d01fd6 | 60 | private: |
mara1802 | 0:33ae04d01fd6 | 61 | DigitalOut led0; |
mara1802 | 0:33ae04d01fd6 | 62 | DigitalOut led1; |
mara1802 | 0:33ae04d01fd6 | 63 | |
mara1802 | 0:33ae04d01fd6 | 64 | }; |
mara1802 | 0:33ae04d01fd6 | 65 | |
mara1802 | 0:33ae04d01fd6 | 66 | #endif |