A speaker consists of a baffle connected to a coil of wire wrapped around a magnetic core. When electricity is passed through the coil it will move, pushing or pulling the baffle, which in turn moves air and produces an audible sound.

Speakers are very low resistance and so require capacitors to block the DC current. An alternative is the piezo which can be driven directly from a PICAXE output line.

Related Commands:

Print Page




Play sounds

This program will play an ascending sequence of tomes through a speaker connected to output pin B.1.

Code Example:
main:	for b1 = 1 to 100	; cycle through sounds
    	  sound B.1, (b1,25)	; play that sound
    	next b1
    	pause 5000		; wait five seconds
    	goto main		; repeat
Copy Code Submit an Example

Create Module

A speaker may be connected via the BCX38C darlington transistor create module (buzzer shown here). However the speaker must be a 32 or 40 ohm (not 8 ohm) type.

Bill of Materials

64 ohm speaker SPE010 1 Buy Now
22uF electrolytic capacitor CAP005 2 Buy Now


No Image Selected

Submit Your Own Code!

You must be logged in to submit code examples. Login now.