Advertisement
pleasedontcode

impossible_project rev_02

Nov 12th, 2023
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: impossible_project
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-11-12 12:36:04
  15.     - Source Code generated by: yuvraj
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <toneAC.h> // Library for playing custom songs
  21.  
  22. /****** SYSTEM REQUIREMENT 1 *****/
  23. /* sing a song at boot in Arduino UNO */
  24. const int speakerPin = 3; // PWM output pin for speaker
  25.  
  26. /****** SYSTEM REQUIREMENT 2 *****/
  27. /* play custom song/audio at boot in Arduino UNO */
  28. const int customSongPin = 4; // PWM output pin for playing custom song
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33.  
  34. void setup(void)
  35. {
  36.   // put your setup code here, to run once:
  37.   pinMode(speakerPin, OUTPUT);
  38.   pinMode(customSongPin, OUTPUT);
  39. }
  40.  
  41. void loop(void)
  42. {
  43.   // put your main code here, to run repeatedly:
  44.  
  45.   // Play a song at boot
  46.   toneAC(speakerPin, 440, 1000); // Play a 440Hz tone for 1 second
  47.  
  48.   // Play a custom song at boot
  49.   toneAC(customSongPin, 523, 500); // Play a 523Hz tone for 0.5 seconds
  50.   delay(500); // Wait for 0.5 seconds
  51.   toneAC(customSongPin, 587, 500); // Play a 587Hz tone for 0.5 seconds
  52.   delay(500); // Wait for 0.5 seconds
  53.   toneAC(customSongPin, 659, 500); // Play a 659Hz tone for 0.5 seconds
  54.   delay(500); // Wait for 0.5 seconds
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement