vježba v6_2 (tipkalo)

Dependencies:   mbed

Committer:
dfraj
Date:
Thu Nov 10 18:18:33 2016 +0000
Revision:
0:3251fe3f8f9b
VT2_dean_fraj

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dfraj 0:3251fe3f8f9b 1 #include "mbed.h"
dfraj 0:3251fe3f8f9b 2 InterruptIn button(p18); // Interrupt on digital pushbutton input p18
dfraj 0:3251fe3f8f9b 3 DigitalOut led1(p5); // digital out to p5
dfraj 0:3251fe3f8f9b 4
dfraj 0:3251fe3f8f9b 5 void toggle(void); // function prototype
dfraj 0:3251fe3f8f9b 6
dfraj 0:3251fe3f8f9b 7 int main() {
dfraj 0:3251fe3f8f9b 8 button.rise(&toggle); // attach the address of the toggle
dfraj 0:3251fe3f8f9b 9 } // function to the rising edge
dfraj 0:3251fe3f8f9b 10
dfraj 0:3251fe3f8f9b 11 void toggle() {
dfraj 0:3251fe3f8f9b 12 led1=!led1;
dfraj 0:3251fe3f8f9b 13 }