Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: impossible_project
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-11-12 12:36:04
- - Source Code generated by: yuvraj
- ********* Pleasedontcode.com **********/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <toneAC.h> // Library for playing custom songs
- /****** SYSTEM REQUIREMENT 1 *****/
- /* sing a song at boot in Arduino UNO */
- const int speakerPin = 3; // PWM output pin for speaker
- /****** SYSTEM REQUIREMENT 2 *****/
- /* play custom song/audio at boot in Arduino UNO */
- const int customSongPin = 4; // PWM output pin for playing custom song
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(speakerPin, OUTPUT);
- pinMode(customSongPin, OUTPUT);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Play a song at boot
- toneAC(speakerPin, 440, 1000); // Play a 440Hz tone for 1 second
- // Play a custom song at boot
- toneAC(customSongPin, 523, 500); // Play a 523Hz tone for 0.5 seconds
- delay(500); // Wait for 0.5 seconds
- toneAC(customSongPin, 587, 500); // Play a 587Hz tone for 0.5 seconds
- delay(500); // Wait for 0.5 seconds
- toneAC(customSongPin, 659, 500); // Play a 659Hz tone for 0.5 seconds
- delay(500); // Wait for 0.5 seconds
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement