내용으로 건너뛰기
사용자 도구
사이트 도구
검색
도구
문서 보기
이전 판
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
English
현재 위치:
index
»
comfilepi
»
piezo_buzzer
comfilepi:piezo_buzzer:index
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
====== 피에조 부저 제어 ====== ComfilePi는 내장된 피에조 부저가 있습니다. 화면을 터치 할 때 기본적으로 울립니다. =====터치음 no/off===== 터치음을 해제(off)하려면 다음 명령을 실행합니다 <code xbasic> sudo systemctl stop touch-beep.service sudo systemctl disable touch-beep.service </code> 터치음을 활성화(on)하려면 다음 명령을 실행합니다 : <code xbasic> sudo systemctl enable touch-beep.service sudo systemctl start touch-beep.service </code> =====피에조 부저 프로그래밍===== 피에조 부저는 GPIO 30Pin에 연결되어있습니다. 피에조 제어 프로그램시 [[http://abyz.co.uk/rpi/pigpio/|pigpio 라이브러리]]를 참조하여 프로그램을 작성할 수 있습니다. <code xbasic> #include <pigpiod_if2.h> #include <thread> using namespace std; #define PIN 30 // CPi-A & CPi-B //#define PIN 27 // CPi-C void play_beep() { auto instance = pigpio_start(NULL, NULL); // We actually can't achieve 2700Hz due to the sampling // rate, but it will do the best it can set_PWM_frequency(instance, PIN, 2700); // 128/255 = 50% duty set_PWM_dutycycle(instance, PIN, 128); // play beep for 100 milliseconds this_thread::sleep_for(chrono::milliseconds(100)); // turn off beep set_PWM_dutycycle(instance, PIN, 0); pigpio_stop(instance); } </code> [[comfilepi:index#추가설명|상위 페이지로 이동]]
comfilepi/piezo_buzzer/index.txt
· 마지막으로 수정됨: 2023/02/01 10:12 저자
Comfile Technology
문서 도구
문서 보기
이전 판
역링크
맨 위로