Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //gcc -Wall -g -o "%e" "%f" -lfreenect -lfreenect_sync
- #include <libfreenect.h>
- #include <libfreenect_sync.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h> //tcgetattr
- #include <termios.h>
- //Change LED of Xbox 360 Kinect
- //gcc -Wall -g -o "%e" "%f" -lfreenect -lfreenect_sync
- //functions
- int getch(){
- //int ch= getchar();
- struct termios oldattr, newattr;
- int ch;
- tcgetattr(STDIN_FILENO, &oldattr);
- newattr = oldattr;
- newattr.c_lflag &= ~(ICANON | ECHO);
- tcsetattr(STDIN_FILENO, TCSANOW, &newattr);
- ch = getchar();
- tcsetattr(STDIN_FILENO, TCSANOW, &oldattr);
- return ch;
- }
- int main(){
- //freenect_led_options led = (freenect_led_options) 0;
- while (1){
- // Check for keyboard input
- char key = getch();
- if(key=='0'){
- freenect_sync_set_led(0, 0);
- printf("%c LED is off\n", key);
- }
- if(key=='1'){
- freenect_sync_set_led(1, 0);
- printf("%c LED is green \n",key);
- }
- if(key=='2'){
- freenect_sync_set_led(2, 0);
- printf("%c LED is red\n",key);
- }
- if(key=='3'){
- freenect_sync_set_led(3, 0);
- printf("%c LED is orange\n", key);
- }
- if(key=='4'){
- freenect_sync_set_led(4, 0);
- printf("%c LED is flashy \n", key);
- }
- else if (key == 'q'){
- printf("Exiting...\n");
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement