diff options
-rw-r--r-- | main.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -59,13 +59,21 @@ int main () { sleepwhile (!gyroscopeRead ()); sleepwhile (twr.status == TWST_WAIT); - - volatile const int16_t *val = gyroscopeGet (); - printf ("%i/%i/%i\n", val[0], val[1], val[2]); - - _delay_ms (50); + switch (twr.status) { + case TWST_OK: { + volatile const int16_t *val = gyroscopeGet (); + printf ("%i/%i/%i\n", val[0], val[1], val[2]); + break; + } + + case TWST_ERR: + goto fail; + break; + } } //timerStop (); +fail: + printf ("fail\n"); /* global interrupt disable */ cli (); |