#include #include #include #include "sonar.h" main() { Sonar sonar; Sonar s2; // Just to test.. int done = 0; float dists[NUM_ULTRASONICS]; fprintf(stderr, "Before sonar.start().\n"); sonar.start(); fprintf(stderr, "Before loop.\n"); while(!kbhit()){ if(sonar.new_data_available()){ sonar.read(dists); for(int i = 0; i < NUM_ULTRASONICS; i++) printf("%d ", (int) (dists[i] * 10)); printf("\n"); } } fprintf(stderr, "Before sonar.stop().\n"); sonar.stop(); printf("Exiting now\n"); }