sender backup

Dependencies:   mbed

Fork of XBee_write by Alex Louden

keypad.cpp

Committer:
bmwaleks
Date:
2018-04-18
Revision:
1:bd05bf8bbe0a
Parent:
0:74b4b9fc9480

File content as of revision 1:bd05bf8bbe0a:

#include "main.h"

int getKeyNum(){

DigitalIn col1(p18);
DigitalIn col2(p20);
DigitalIn col3(p16);

DigitalOut row1(p19);
DigitalOut row2(p14);
DigitalOut row3(p15);
DigitalOut row4(p17);

    row1 = 1;
    row2 = 0;
    row3 = 0;
    row4 = 0;
    
    if (col1)
        return 1;
    else if (col2)
        return 2;
    else if (col3)
        return 3; 
        
    row1 = 0;
    row2 = 1;
    row3 = 0;
    row4 = 0;
    
    if (col1)
        return 4;
    else if (col2)
        return 5;
    else if (col3)
        return 6;     
    
    row1 = 0;
    row2 = 0;
    row3 = 1;
    row4 = 0;
    
    if (col1)
        return 7;
    else if (col2)
        return 8;
    else if (col3)
        return 9;  
        
    row1 = 0;
    row2 = 0;
    row3 = 0;
    row4 = 1;
    
    if (col1)
        return -2;
    else if (col2)
        return 0;
    else if (col3)
        return -3;  
                   
    row1 = 0;
    row2 = 0;
    row3 = 0;
    row4 = 0;
    
    return -1;
}