• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoRoutine 7 buzzer experiments
Previous Next

Routine 7 buzzer experiments

Posted by: admin , March 14, 2014

[vc_row][vc_column][vc_column_text]Arduino 入门学习

Arduino can be done with a lot of interactive work, the most common and most commonly used is
the sound and light show in front has been in use LED lights in the experiment, the experiment let
everyone circuit sound, with a voice the most common is the buzzer and speaker components, the
comparison of the two buzzer easier and ease the present study, we buzzer

[/vc_column_text][vc_tour interval=”0″][vc_tab title=”Part list” tab_id=”1394783554-1-68″][vc_column_text]Buzzer * 1
Buttons * 1
Bread board * 1
Breadboard Jumper[/vc_column_text][/vc_tab][vc_tab title=”Wiring Diagram” tab_id=”1394783554-2-37″][vc_column_text]According to the following diagram to connect the circuit
Connect the circuit to the attention of the positive and negative point is that the buzzer of the
points, can be seen below on the right physical map buzzer red and black two wiring. Connect the
circuit program in this regard is very simple, with small lights front control buttons experimental
procedure is similar because of the buzzer output control interface Digital interface also can
control the high and low buzzer sounds.

7.17.2[/vc_column_text][/vc_tab][vc_tab title=”Test code” tab_id=”1394783770668-2-3″][vc_column_text]

int buzzer = 8 ;/ / setting controls the digital IO foot buzzer
void setup ()
{
pinMode (buzzer, OUTPUT) ;/ / set the digital IO pin mode, OUTPUT out of Wen
}
void loop ()
{
unsigned char i, j ;/ / define variables
while (1)
{
for (i = 0; i <80; i + +) / / Wen a frequency sound
{
digitalWrite (buzzer, HIGH) ;/ / send voice
delay (1) ;/ / Delay 1ms
digitalWrite (buzzer, LOW) ;/ / do not send voice
delay (1) ;/ / delay ms
}
for (i = 0; i <100; i + +) / / Wen Qie out another frequency sound
{
digitalWrite (buzzer, HIGH) ;/ / send voice
delay (2) ;/ / delay 2ms
digitalWrite (buzzer, LOW) ;/ / do not send voice
delay (2) ;/ / delay 2ms
}
}
}
After downloading the program, the buzzer experiments are done
<a href="http://learn.linksprite.com/wp-content/uploads/2014/03/7.3.png"><img class="aligncenter" alt="7.3" src="http://learn.linksprite.com/wp-content/uploads/2014/03/7.3.png" /></a>

[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: Arduino, Arduino Esplora

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors