Has anyone attempted to use the Speaker port on the Cortex controller? If so what type of speaker are you using and are you able to play sounds from the sound library?
I am using RobotC. Currently I just have a normal 2-wire 8ohm speaker connected to the PWM 29-controller and into a motor port. I am able to produce sounds of different frequencies through that but I saw that RobotC has functions for playing sounds in their sound library. So I’m just curious as to how that works.
I’ve used it a bit, and it works pretty well. The speaker port on the Cortex is actually a DAC (Digital-to-analog convertor) so it provides a “cleaner” output to the speaker than the PWM motor output can. I wrote a little function that takes strings and plays them as tunes:
It handles sharps/flats, tempo, multiple octaves, etc. It isn’t going to win a Technical Grammy, but let me know if you want me to post it.
I wouldn’t connect an 8Ω speaker directly to the SP port, though, because it won’t be very loud (not enough current drive from the SP port) and there is some risk of damaging the port.
I used a simple LM386 amplifier that I made, and I’ve also used this amp successfully with the Cortex SP port. You’ll need a cable with a couple resistors in it to drop the signal down to a line-level audio signal (otherwise you have to be VERY careful never to turn the volume up above about 10%). I can post the details of the cable I made this evening if you are interested.