Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11월 23일 12:37 #14

Open
GeekTree0101 opened this issue Nov 23, 2016 · 0 comments
Open

11월 23일 12:37 #14

GeekTree0101 opened this issue Nov 23, 2016 · 0 comments

Comments

@GeekTree0101
Copy link
Owner

새로운 기능 추가

  1. 피에조 스피커 탑재

전역변수 영역



#define Motion_button 12
#define ZoomIn_button 11
#define Drawing_button 10             
#define Next_Page_button 9
#define Back_Page_button 8
#define Speaker 7                            // <-------------------   스피커 출력 핀 번호
#define Lazer_button 6

#define key_press_delay 30              
#define mouse_press_delay 50
#define Hardware_delay 10               
#define SPEAKER_DURATION 100    //<------------------------- 음 길이
#define LOCK_DRURATION 200

tone API 사용 tone(핀번호, 주파수[Hz단위], 음 길이)


        if(digitalRead(Next_Page_button) == LOW && lock == 0){          

            packet = packet + "*";
            packet = packet  + DATA_PASSPAGE; 
            packet = packet + "/";
            packet = packet + X ;
            packet = packet + "/";
            packet = packet + Y;
            packet = packet + "/";
            packet = packet + "*";
            Serial1.println(packet); 
            
            lock_check = true;
            lock++;
            tone(Speaker, 2000, SPEAKER_DURATION);    //<-------- tone API 사용
        }

줌인아웃/ 도로잉 기능은 구분하기 위해서 소리 변화를 줌


 else if(digitalRead(ZoomIn_button) == LOW  && lock == 0){             //ZoomIn Function

            packet = packet + "*";
            packet = packet  + DATA_ZOOMIN; 
            packet = packet + "/";
            packet = packet + X ;
            packet = packet + "/";
            packet = packet + Y;
            packet = packet + "/";
            packet = packet + "*";
            Serial1.println(packet); 
            
            lock++;
            zoomin_flag = ~zoomin_flag + 2;
            lock_check = true;
            
            if(sound_effect == true){
              tone(Speaker, 1000, SPEAKER_DURATION);
              sound_effect = false;
            }
            else{
              tone(Speaker, 2000, SPEAKER_DURATION);
              sound_effect = true;
            }           
        }
  1. 페이지 넘기기, 뒤로 넘기기 추가

#define DATA_PASSPAGE 4
#define DATA_BACKPAGE 5

구현

airpointer.ino

  if(digitalRead(Next_Page_button) == LOW && lock == 0){              //Click Function

         packet = packet + "*";
         packet = packet  + DATA_PASSPAGE; 
         packet = packet + "/";
         packet = packet + X ;
         packet = packet + "/";
         packet = packet + Y;
         packet = packet + "/";
         packet = packet + "*";
         Serial1.println(packet); 
         
         lock_check = true;
         lock++;
         tone(Speaker, 2000, SPEAKER_DURATION);
     }
     else if(digitalRead(Back_Page_button) == LOW && lock == 0){              //Click Function
         
         packet = packet + "*";
         packet = packet  + DATA_BACKPAGE; 
         packet = packet + "/";
         packet = packet + X ;
         packet = packet + "/";
         packet = packet + Y;
         packet = packet + "/";
         packet = packet + "*";
         Serial1.println(packet); 
         
         lock_check = true;
         lock++;
         tone(Speaker, 1000, SPEAKER_DURATION);
     }

bridge.ino

               case DATA_PASSPAGE:

                    Mouse.click(MOUSE_LEFT);
                    delay(500);
                    break;
                case DATA_BACKPAGE:
                    Keyboard.press('p');
                    delay(key_press_delay);
                    Keyboard.release('p');
                    delay(500);
                    break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant