Interrupt Lab

Dependencies:   mbed

main.cpp

Committer:
FrankDoherty86
Date:
2019-05-24
Revision:
0:82470c7cda3a
Child:
1:82217c93a7dd

File content as of revision 0:82470c7cda3a:

#include "mbed.h"

Serial pc(USBTX, USBRX);
InterruptIn button1(p12);
InterruptIn button2(p13);
InterruptIn button3(p14);
InterruptIn button4(p15);
InterruptIn button5(p16);

int down=0;
int left=0;
int center=0;
int up=0;
int right=0;

void down_check()
                {
                    printf("Joystick is pressed towards Down direction\n\r");
                    wait (2);
                    }
void left_check()
                {
                    printf("Joystick is pressed towards Left direction\n\r");
                    wait (2);
                    }
void center_check()
                {
                    printf("Joystick is pressed towards Center direction\n\r");
                    wait (2);
                    }
void up_check()
                {
                    printf("Joystick is pressed towards Up direction\n\r");
                    wait (2);
                    }
void right_check()
                {
                    printf("Joystick is pressed towards Right direction\n\r");
                    wait (2);
                    }
                int main()
                {
                //timer_temp start();
                button1.rise (&down_check);
                button2.rise (&left_check);
                button3.rise (&center_check);
                button4.rise (&up_check);
                button5.rise (&right_check);
                
                }