void setup() {
// put your setup code here, to run once:
//F is output port // K is input port
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) == 0x01)
*outf = 0x01; //when switch is pressed make it 1 //0x01 means 0b00000001 => bit 0 is ON or Output
else
*outf = 0x00; //otherwise 0
}
}
void loop() {
// put your main code here, to run repeatedly:
}