Skip to content

11월 23일 12:37 #14

@GeekTree0101

Description

@GeekTree0101

새로운 기능 추가

  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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions