Advertisement
j0h

xbox360Kinect_Tilt_patrol

j0h
Jul 6th, 2023
859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1. //gcc -Wall -g -o "%e" "%f"  -lfreenect -lfreenect_sync  
  2. #include <libfreenect.h>
  3. #include <libfreenect_sync.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <unistd.h>  //tcgetattr and sleep
  7.  
  8. int count = 0;  //counter for tilt
  9. void no_kinect_quit(void){
  10.     printf("Error: Kinect not connected?\n");
  11.     exit(1);
  12. }
  13.  
  14. int main(int argc, char *argv[]){
  15.     while (1) {
  16. //pan back and forth mindlessly
  17.     //  int tilt = count;  // -15 to 14
  18. for (int count =0 ; count<=16; count+=2){
  19.         // Set the tilt angle (in degrees)
  20.         if (freenect_sync_set_tilt_degs(count, 0)) no_kinect_quit();
  21.             printf("tilt[%d] \n", count);
  22.             sleep(1);
  23.             }
  24. for (int count = 16; count>= -16 ; count-=2){
  25.         // Set the tilt angle (in degrees)
  26.         if (freenect_sync_set_tilt_degs(count, 0)) no_kinect_quit();
  27.             printf("tilt[%d] \n", count);
  28.             sleep(1);
  29.             }
  30.        }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement