As i read Reserved words.pdf of Robotc, it says this code “Playtone(220, 500)” can play sound when external piezoelectric speaker is connected to motor port1. But my robot can’t paly any sound when i do this.
Can anyone help me in programming to make robot play sound?
Maybe my speaker is not piezolelectric speaker?
By the way, what does piezoelectric speaker look like? Any external features different from normal speakers?
Well, a piezo buzzer just needs DC power to operate. They generally produce one single tone when you apply power. There are fancier ones that can produce other sound effects, but they tend to be on when power is applied and off when it isn’t.
A piezo speaker is like a regular speaker in that you feed it an AC signal that it converts into sound. Higher frequency signals will produce higher pitched notes. Higher amplitude signals will produce louder notes.
I believe the RobotC libraries are expecting a piezo speaker rather than a piezo buzzer to be attached. I doubt a buzzer will work at all, or at least not well, but I haven’t personally tried it.
I suspect you’d get some sound, though I don’t know if it would be very loud. You should wire it between the outer two contacts on the port (white and black if you are using an extension cable).