Vjezba 6_4
Dependencies: mbed
main.cpp@8:e81d54d7ced6, 2016-11-10 (annotated)
- Committer:
- imihalj
- Date:
- Thu Nov 10 18:18:17 2016 +0000
- Revision:
- 8:e81d54d7ced6
- Parent:
- 7:c56b212b084e
vjezba6_4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
imihalj | 6:ca9ae5ce232d | 1 | #include "mbed.h" |
imihalj | 8:e81d54d7ced6 | 2 | InterruptIn button(p18); // Interrupt on digital pushbutton input p18 |
imihalj | 8:e81d54d7ced6 | 3 | DigitalOut led1(p5); // digital out to p5 |
imihalj | 8:e81d54d7ced6 | 4 | void toggle(void); // function prototype |
imihalj | 0:c32036656bb4 | 5 | int main() |
imihalj | 0:c32036656bb4 | 6 | { |
imihalj | 8:e81d54d7ced6 | 7 | button.rise(&toggle); // attach the address of the toggle |
imihalj | 8:e81d54d7ced6 | 8 | } // function to the rising edge |
imihalj | 8:e81d54d7ced6 | 9 | void toggle() |
imihalj | 8:e81d54d7ced6 | 10 | { |
imihalj | 8:e81d54d7ced6 | 11 | led1=!led1; |
imihalj | 5:94aa173f182c | 12 | } |