6.4 Tipkalo

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 InterruptIn button(p18); // Interrupt on digital pushbutton input p18
00003 DigitalOut led1(p5); // digital out to p5
00004 void toggle(void); // function prototype
00005 int main()
00006 {
00007     button.rise(&toggle); // attach the address of the toggle
00008 } // function to the rising edge
00009 void toggle()
00010 {
00011     led1=!led1;
00012 }