void setup() {
// put your setup code here, to run once:
volatile char *dirf,*dirk,x;
volatile char *outf,*ink;
dirf = 0x30; dirk = 0x107;
outf = 0x31; ink = 0x106;
*dirf = 0x01; // to make only 1 bit as output // setting as output
*dirk = 0x00; // making all input
while(1) //always in the loop
{
x = *ink; //read
if(x == 0x01) //if x is 1 and only 1
*outf = 0x02; //when switch is pressed make it 1 // here 0b00000010 //also try 0x03 or 0b00000011
else
*outf = 0x00; //otherwise 0
}
}
void loop() {
// put your main code here, to run repeatedly:
}