Advertisement
pleasedontcode

**Audio Gain** rev_09

Dec 8th, 2024
55
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: **Audio Gain**
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-12-08 10:32:30
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* after power change gain to max volume. */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /* START CODE */
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <Wire.h>
  27. #include <PT2314.h> //https://github.com/RobTillaart/PT2314
  28.  
  29. /****** FUNCTION PROTOTYPES *****/
  30. void setup(void);
  31. void loop(void);
  32.  
  33. /***** DEFINITION OF I2C PINS *****/
  34. const uint8_t nj_PT2314_I2C_PIN_SDA_A4      = A4;
  35. const uint8_t nj_PT2314_I2C_PIN_SCL_A5      = A5;
  36. const uint8_t nj_PT2314_I2C_SLAVE_ADDRESS       = 68;
  37.  
  38. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  39. PT2314 audioProcessor(&Wire); // Create an instance of the PT2314 class
  40.  
  41. void setup(void)
  42. {
  43.     // Initialize I2C communication
  44.     Wire.begin(nj_PT2314_I2C_PIN_SDA_A4, nj_PT2314_I2C_PIN_SCL_A5);
  45.    
  46.     // Initialize the audio processor
  47.     if (audioProcessor.begin()) {
  48.         // Set gain to maximum volume after power change
  49.         audioProcessor.setGain(0); // Assuming 0 is max gain based on the library's implementation
  50.     }
  51. }
  52.  
  53. void loop(void)
  54. {
  55.     // put your main code here, to run repeatedly:
  56. }
  57.  
  58. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement