Promjena stanja ledice
On_Off.cpp@0:5cd439f68160, 2021-02-20 (annotated)
- Committer:
- ekunovic
- Date:
- Sat Feb 20 16:19:16 2021 +0000
- Revision:
- 0:5cd439f68160
Seminarski rad za kolegij mikroupravljaci
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ekunovic | 0:5cd439f68160 | 1 | #include "On_Off.h" |
ekunovic | 0:5cd439f68160 | 2 | #include "mbed.h" |
ekunovic | 0:5cd439f68160 | 3 | LED::LED(PinName pin) : _pin(pin) |
ekunovic | 0:5cd439f68160 | 4 | { |
ekunovic | 0:5cd439f68160 | 5 | _pin = 0; |
ekunovic | 0:5cd439f68160 | 6 | } |
ekunovic | 0:5cd439f68160 | 7 | |
ekunovic | 0:5cd439f68160 | 8 | //Metoda određuje stanje LED |
ekunovic | 0:5cd439f68160 | 9 | void LED::status(int status) |
ekunovic | 0:5cd439f68160 | 10 | { |
ekunovic | 0:5cd439f68160 | 11 | _pin = status; |
ekunovic | 0:5cd439f68160 | 12 | } |
ekunovic | 0:5cd439f68160 | 13 | |
ekunovic | 0:5cd439f68160 | 14 | |
ekunovic | 0:5cd439f68160 | 15 | //Metoda mijenja stanje na LED |
ekunovic | 0:5cd439f68160 | 16 | void LED::flip() |
ekunovic | 0:5cd439f68160 | 17 | { |
ekunovic | 0:5cd439f68160 | 18 | _pin = !_pin; |
ekunovic | 0:5cd439f68160 | 19 | } |