Elegoo lesson 2.6 for Mega 2560

Hi, newbie here. I am trying to use a passive buzzer and each time I upload the code it gives me an error. Please help me correct the code. I included the image of the code and error message as an attachment so you can see exactly what is happening. My board is a Meaga 2560 and I am using digital pin 8 for the positive wire and the Ground pin on the digital side (same side as pin 8).
The code that I am uploading was made by elegoo as one of their official lessons. I am also uploading the file with original code in case you wanna adjust code for testing purposes. I am using a Macbook.


passive_buzzer.ino (527 Bytes)

Just about the worst way to post code and error messages is by posting an image. Post the code properly so that we do not have to download it. There is more information in the error message than shown in the image.

Read the how to use this forum-please read sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

You need to put a copy of the pitches.h file in the sketch directory.

My Mega has no smiley face pin. :slight_smile:

When you unzipped that lesson, you got more than just the INO file. Navigate to the directory where the ZIP file was, then copy 'pitches\pitches\pitches.h' (yes, it's really in that stupid location, at least on my machine) into the same directory as the INO file.

Thanks MHotchin, worked like a charm. :grinning: :grinning: