Simple library, creates LED object using LED class, and gives it flip function that changes its value from 0 to 1 and vice versa.
led.cpp@0:f7dc5fd660f6, 2020-11-15 (annotated)
- Committer:
- khodak
- Date:
- Sun Nov 15 18:55:08 2020 +0000
- Revision:
- 0:f7dc5fd660f6
Simple led library that creates object LED with LED class and has a flip method to flip LED value from 0 to 1 and vice versa.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
khodak | 0:f7dc5fd660f6 | 1 | #include "led.h" |
khodak | 0:f7dc5fd660f6 | 2 | #include "mbed.h" |
khodak | 0:f7dc5fd660f6 | 3 | LED::LED(PinName pin) : _pin(pin) |
khodak | 0:f7dc5fd660f6 | 4 | { |
khodak | 0:f7dc5fd660f6 | 5 | _pin = 0; |
khodak | 0:f7dc5fd660f6 | 6 | } |
khodak | 0:f7dc5fd660f6 | 7 | //Metoda mijenja stanje na LED |
khodak | 0:f7dc5fd660f6 | 8 | void LED::flip() |
khodak | 0:f7dc5fd660f6 | 9 | { |
khodak | 0:f7dc5fd660f6 | 10 | _pin = !_pin; |
khodak | 0:f7dc5fd660f6 | 11 | } |