[vc_row][vc_column width=”1/1″ el_class=”Parts List”][vc_column_text]In this project, we will control the buzzer with an LDR that is sensitive to the light of environment.[/vc_column_text][vc_tour][vc_tab title=”Parts List” tab_id=”1395018009-1-46″][vc_column_text]1. 1 x LDR
2. 1 x [bigcommerce link=”/buzzer-module-of-linker-kit-for-pcduino-arduino/” target=”_blank”]Buzzer[/bigcommerce]
3. [bigcommerce link=”/breadboard-jumper-wire-set-140pcs/” target=”_blank”]Jumper wires[/bigcommerce][/vc_column_text][/vc_tab][vc_tab title=”Wiring Diagram” tab_id=”1395018009-2-87″][vc_column_text][/vc_column_text][/vc_tab][vc_tab title=”Theory” tab_id=”1395018332364-2-4″][vc_column_text]The code will read the ADC that is used to measure the voltage of the LDR. When the intensity of light increases, the resistance of the LDR decreasse, and the voltage applied to the buzzer will increase, which will lead to louder sound.
[/vc_column_text][/vc_tab][vc_tab title=”Arduino Code” tab_id=”1395018954151-3-2″][vc_column_text]
void setup () { pinMode (6, OUTPUT); } void loop () { while (1) { char i, j; while (1) { for (i = 0; i <80; i) / / Wen Qie one frequency sound { digitalWrite (6, HIGH); delay (1); digitalWrite (6, LOW); delay (1); } for (i = 0; i <100; i) / / Wen Qie out another frequency sound { digitalWrite (6, HIGH); delay (2); digitalWrite (6, LOW); delay (2); } } } }
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.