3PI Basic Beep Noise

Hi,

I’m trying to write a completely contained program that makes a simple buzzing noise.

For Example, this line of code makes the 3PI beep:

[code]#include <pololu/3pi.h>

int main()
{
play_from_program_space(PSTR(">g32>>c32")); // Play welcoming notes.
}[/code]

What would I have to shift my PORTS/PINs to make a program that do the “g32” and “c32”, that has all the code in the same file.

I know that the code below will be needed, but how can get something like playNote(32) be be written?

[code]

#define SILENT_NOTE 0xFF //silence the buzzer
#define BUZZER_DDR DDRD
#define BUZZER (1 << PORTD4)
#define BUZZER_IO IO_D4[/code]

Hi,

I’m trying to get my 3pi to make any noise from the buzzer. I want it make using closed libraries, and not use any of the build in functions by setting the PORT/DDR myself.

What would be the same as:

[code]

#include <pololu/3pi.h>

int main()
{
play_from_program_space(PSTR(">g32>>c32")); // Play welcoming notes.
}[/code]

If I also want to set the DDR’s myself

#define BUZZER_DDR DDRD #define BUZZER (1 << PORTD4) #define BUZZER_IO IO_D4

Hello.

We merged your two posts since they are about the same question.

It might be helpful for you to look at the OrangutanBuzzer library to get a better understanding on how the library’s functions work (e.g. playNote()). You can find a detailed description of the functions in the OrangutanBuzzer library in section 3 in the Pololu AVR Library Command Reference user’s guide.

If try writing the code and run into issues, you can post your entire code here, and I would be happy to take a look.

- Amanda