void setup() {
// put your setup code here, to run once:
volatile char *dirf,*dirk,*dira,*dirc;
volatile char *outf,*ink,*outa,*outc;
volatile long i,j;
dirf=0x30;dirk=0x107;dira=0x21;dirc=0x27;
outf=0x31;ink=0x106;outa=0x22;outc=0x28;
*dirf=0x0F;*dirk=0x00;*dira=0x0F;*dirc=0x0f;
while(1){
for(i=0;i<4;i++){
*outf=1<<i;// rows are getting active
*outa=*ink; // user input on keypad,column led on
if(*ink!=0){
*outc=1<<i; //row led on
for(j=0;j<100000;j++); //delay
*outc=0; //row led off
*outa=0;//column led off
}
}
}
}
void loop() {
// put your main code here, to run repeatedly:
}