I’d just like some guidance as to how you think I could go about adding a speaker (that will be used to play musical notes) to the 3pi. I am currently using the P0 and P1 pins for a master slave connection with an arduino board, so can’t really wire the speaker to that.
The reason why I am opting not to use the buzzer is due to the fact that the notes played via the buzzer don’t work well with my tone analysis system running on the Arduino.
I have the speaker running great on the arduino, but realised that I can’t analyse the sound and play it at the same time.
So hoping the 3pi can play the notes and the Arduino can analyse it through a microphone.
Any help would be much appreciated
-Emma
EDIT:
[Or is it really just a matter of connecting the grounds, the power to vcc and the signal to pc5. Then in Arduino writing the audio output to pin 19?] <—solved
And if attached to the 3pi is there anyway to control the volume?
I don’t understand from your post what you are doing, does “solved” mean your latest wiring working? You can control the volume of a speaker by changing the duty cycle of the PWM that you are driving the speaker with. Our AVR library has buzzer control functions that let you change the volume.
I have attached a speaker to PC5 and ground, but have found that when I run the default line follower code on the 3pi it writes to the PC5 pin and thus plays this high pitched tone. Is there anyway to stop this so that the line follower code does not write to PC5?
EDIT I am using the Arduino IDE and therefore can’t make much sense out of:
When you initialize the 3pi code, you can use the disable_emitter parameter to tell the library to not use the emitter pin at all. Does this make sense?
That isn’t valid C/C++. It’s just a function call, so you would do what you would for any other function call:
robot.init(1000, 1);
The syntax you are copying from the command reference is how the methods are declared, and the “= 1000” part means that the associated variable will get the default value of 1000 if it is not specified. For example, if the method is declared: