Pages: [1]   Go Down
Author Topic: Connect speaker to analog pin?  (Read 1533 times)
0 Members and 1 Guest are viewing this topic.
Sweden
Offline Offline
Jr. Member
**
Karma: 0
Posts: 80
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, i see all the tutorials and schematics of how people hook up there small 0.5watt speakers to digital pin 8 on there Arduinos... but mine is full... i have only a couple of analog pins free... can i set the output as a Speakerpin = A4 or something? or do i have to use no 8? i will only use it to play simple tones or very basic melodies!

Cheers smiley

Edit... i see now that i have pin 5 free... and it is a pwm to! that would work right?
« Last Edit: March 15, 2013, 03:50:00 am by Corpze » Logged

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The tone library can use any pin, http://arduino.cc/en/Reference/Tone
The output of tone is handled in a software interrupt routine (generated by a timer), as far as I remember.
But if you already use PWM on pin 3 or 11, you can't use the tone library, since it uses the same timer.

An analog pin can be used as a digital pin. So you can use any analog (A0 ... A5) or digital pin (0...13).

Use a 100 Ohm resistor in series with the speaker.
Logged

Sweden
Offline Offline
Jr. Member
**
Karma: 0
Posts: 80
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pin 3 i use to the EasyDriver stepper motor board, pin 11 is connected to a LCD... so i think i am good smiley
Logged

Pages: [1]   Go Up
Jump to: