Mario Barisic
/
TINF_blinky_klase
29.9.2020
Diff: main.cpp
- Revision:
- 0:2e7c943c07a9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 29 15:52:57 2020 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" + +//DigitalOut myled(LED1); + +class MyLed { + public: + MyLed(PinName led) : _led(led) { + _led = 1; + } + + void ledOn(void) { + _led = 1; + wait_ms(500); + } + + MyLed() {}; + + private: + DigitalOut _led; + }; + +MyLed myLed(LED1); +MyLed myLed2(LED2); + +int main() { + while(1) { + myLed.ledOn(); + myLed.ledOff(); + myLed2.ledOn(); + myLed2.ledOff(); + } +}