Updated version with proper challenge/response code

master
Wilhelm Westermark 7 years ago
parent 66d4364b56
commit 5afa7988fc

@ -1,4 +1,4 @@
O/*
/*
*i2ctest.c
* Raspberry Pi I2C test using wiringPi library.
*
@ -35,28 +35,24 @@ int main (int argc, char *argv[])
}
else
{
while(data != 6) {
wiringPiI2CWrite(fd, send);
delay(1);
while(1) {
wiringPiI2CWrite(fd, send);
data=wiringPiI2CRead(fd);
printf(" Received data=%d\n", data);
if(data==-1)
{
printf("No data\n");
//return -1;
}
else if(data == send*3) {
printf("Sending challenge");
wiringPiI2CWrite(fd, 4);
}
else if(data == 6) {
printf("Read proper response \n");
else if(data == 17) {
printf("Exit code received \n");
break;
}
else
{
//print data
printf("Waiting to send challenge");
}
printf(" data=%d\n", data);
else if(data != 0) {
printf("Sending response %d\n", data+3 );
wiringPiI2CWrite(fd, data+3);
}
}
}

Loading…
Cancel
Save