Go Down

Topic: Connect speaker to analog pin? (Read 1 time) previous topic - next topic


Mar 15, 2013, 09:09 am Last Edit: Mar 15, 2013, 09:50 am by Corpze Reason: 1
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 :)

Edit... i see now that i have pin 5 free... and it is a pwm to! that would work right?


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.


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

Go Up