Guest User

Arduino code for 2 LEDs 2 buttons 2 potentiometers & 1 buzzer

a guest
Jun 8th, 2025
141
0
Never
9
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 27.30 KB | Software | 0 0
  1. #include <SPI.h>
  2. #include <Wire.h>
  3. #include <Adafruit_NeoPixel.h>
  4.  
  5. #define PIN 3 // This is the Arduino Pin controlling the LED pixel.
  6. #define PIN2 5 // This is the Arduino Pin controlling the other LED pixel.
  7. #define POTENTIOMETER_PIN A0
  8. #define POTENTIOMETER_PIN2 A2
  9. #define BUZZER_PIN 11
  10.  
  11.  
  12. //This sketch is to make a potentiometer position determine a color of a LED
  13. // that shows when a button is pressed
  14.  
  15. //If possible, another potentiometer to determine tone
  16.  
  17. #define NUMPIXELS 1
  18. #define BRIGHTNESS 50
  19. Adafruit_NeoPixel pxl = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRBW + NEO_KHZ800);
  20. Adafruit_NeoPixel pxl2 = Adafruit_NeoPixel(NUMPIXELS, PIN2, NEO_GRBW + NEO_KHZ800);
  21. #define PUSH_BUTTON   9
  22. #define PUSH_BUTTON2   7
  23.  
  24. #define REST 0
  25. #define NOTE_B0  31
  26. #define NOTE_C1  33
  27. #define NOTE_CS1 35
  28. #define NOTE_D1  37
  29. #define NOTE_DS1 39
  30. #define NOTE_E1  41
  31. #define NOTE_F1  44
  32. #define NOTE_FS1 46
  33. #define NOTE_G1  49
  34. #define NOTE_GS1 52
  35. #define NOTE_A1  55
  36. #define NOTE_AS1 58
  37. #define NOTE_B1  62
  38. #define NOTE_C2  65
  39. #define NOTE_CS2 69
  40. #define NOTE_D2  73
  41. #define NOTE_DS2 78
  42. #define NOTE_E2  82
  43. #define NOTE_F2  87
  44. #define NOTE_FS2 93
  45. #define NOTE_G2  98
  46. #define NOTE_GS2 104
  47. #define NOTE_A2  110
  48. #define NOTE_AS2 117
  49. #define NOTE_B2  123
  50. #define NOTE_C3  131
  51. #define NOTE_CS3 139
  52. #define NOTE_D3  147
  53. #define NOTE_DS3 156
  54. #define NOTE_E3  165
  55. #define NOTE_F3  175
  56. #define NOTE_FS3 185
  57. #define NOTE_G3  196
  58. #define NOTE_GS3 208
  59. #define NOTE_A3  220
  60. #define NOTE_AS3 233
  61. #define NOTE_B3  247
  62. #define NOTE_C4  262
  63. #define NOTE_CS4 277
  64. #define NOTE_D4  294
  65. #define NOTE_DS4 311
  66. #define NOTE_E4  330
  67. #define NOTE_F4  349
  68. #define NOTE_FS4 370
  69. #define NOTE_G4  392
  70. #define NOTE_GS4 415
  71. #define NOTE_A4  440
  72. #define NOTE_AS4 466
  73. #define NOTE_B4  494
  74. #define NOTE_C5  523
  75. #define NOTE_CS5 554
  76. #define NOTE_D5  587
  77. #define NOTE_DS5 622
  78. #define NOTE_E5  659
  79. #define NOTE_F5  698
  80. #define NOTE_FS5 740
  81. #define NOTE_G5  784
  82. #define NOTE_GS5 831
  83. #define NOTE_A5  880
  84. #define NOTE_AS5 932
  85. #define NOTE_B5  988
  86. #define NOTE_C6  1047
  87. #define NOTE_CS6 1109
  88. #define NOTE_D6  1175
  89. #define NOTE_DS6 1245
  90. #define NOTE_E6  1319
  91. #define NOTE_F6  1397
  92. #define NOTE_FS6 1480
  93. #define NOTE_G6  1568
  94. #define NOTE_GS6 1661
  95. #define NOTE_A6  1760
  96. #define NOTE_AS6 1865
  97. #define NOTE_B6  1976
  98. #define NOTE_C7  2093
  99. #define NOTE_CS7 2217
  100. #define NOTE_D7  2349
  101. #define NOTE_DS7 2489
  102. #define NOTE_E7  2637
  103. #define NOTE_F7  2794
  104. #define NOTE_FS7 2960
  105. #define NOTE_G7  3136
  106. #define NOTE_GS7 3322
  107. #define NOTE_A7  3520
  108. #define NOTE_AS7 3729
  109. #define NOTE_B7  3951
  110. #define NOTE_C8  4186
  111. #define NOTE_CS8 4435
  112. #define NOTE_D8  4699
  113. #define NOTE_DS8 4978
  114.  
  115.  
  116. int PXL1[] = {0};
  117. int PXL2[] = {0};
  118.  
  119.  
  120.  
  121. bool BUTTON_PRESSED = false;
  122. bool BUTTON_PRESSED2 = false;
  123.  
  124. int delayval = 50;
  125.  
  126. int melody[] = {
  127.   NOTE_E3, NOTE_DS3, NOTE_FS3, NOTE_E3, NOTE_G3, NOTE_FS3, NOTE_A3, NOTE_G3, NOTE_AS3, NOTE_B3, NOTE_E4, NOTE_E5, NOTE_DS5, NOTE_D5, NOTE_CS5, REST, NOTE_DS5, NOTE_D5, NOTE_CS5, NOTE_C5, REST, NOTE_FS5, NOTE_FS5, NOTE_E5
  128. };
  129.  
  130. // note durations: 4 = quarter note, 8 = eighth note, etc.:
  131. int noteDurations[] = {
  132.   2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 3, 12, 12, 12, 1, 16, 12, 12, 12, 1, 16, 4, 2, 1
  133. };
  134.  
  135. void setup() {
  136.   // put your setup code here, to run once:
  137.      pinMode(BUZZER_PIN, OUTPUT);
  138.   pinMode(PUSH_BUTTON, INPUT_PULLUP);
  139.     pinMode(PUSH_BUTTON2, INPUT_PULLUP);
  140. //  pinMode(LED, OUTPUT);
  141.   pxl.begin();
  142.   pxl.show();            // Turn OFF all strip ASAP
  143.   pxl.setBrightness(BRIGHTNESS);
  144.  
  145.  
  146.   pxl2.begin();
  147.   pxl2.show();            // Turn OFF all strip ASAP
  148.   pxl2.setBrightness(BRIGHTNESS);
  149.  
  150. }
  151.  
  152. void loop() {
  153.  
  154.  
  155.  
  156. if(!digitalRead(PUSH_BUTTON)){
  157.   BUTTON_PRESSED = true;
  158.   delay(200);
  159.   }else{
  160.    BUTTON_PRESSED = false;
  161.     }
  162.    
  163.  if(!digitalRead(PUSH_BUTTON2)){
  164.   BUTTON_PRESSED2 = true;
  165.   delay(200);
  166.   }else{
  167.    BUTTON_PRESSED2 = false;
  168.     }
  169.  
  170.     int potentiometerValue = analogRead(POTENTIOMETER_PIN); //read the first potentiometer for the LEDs
  171.     int percent = map(potentiometerValue, 0, 1023, 0, 100); //map the pot value to percent
  172.    
  173.     int potentiometerValue2 = analogRead(POTENTIOMETER_PIN2); //read the second potentiometer for the buzzer
  174.     int percent2 = map(potentiometerValue2, 0, 1023, 0, 100); //map the pot value to percent
  175.  
  176. if(percent2 >= 0 && percent2 <= 2){
  177.     if(BUTTON_PRESSED2){
  178. //play tone
  179. tone(BUZZER_PIN, NOTE_B0);
  180.     }else{
  181.  //play no tone
  182.  noTone(BUZZER_PIN);
  183.  }
  184.    }else if(percent2 > 2 && percent2 < 4){
  185.   //draw2();
  186.  if(BUTTON_PRESSED2){
  187.       tone(BUZZER_PIN, NOTE_C1);
  188.     }else{
  189.       noTone(BUZZER_PIN);
  190.  }
  191.  
  192.   }else if(percent2 > 3 && percent2 < 5){
  193.      if(BUTTON_PRESSED2){
  194.       tone(BUZZER_PIN, NOTE_CS1);
  195.     }else{
  196.       noTone(BUZZER_PIN);
  197.     }
  198.  }else if(percent2 > 4 && percent2 < 6){
  199.      if(BUTTON_PRESSED2){
  200.       tone(BUZZER_PIN, NOTE_D1);
  201.     }else{
  202.       noTone(BUZZER_PIN);
  203.     }
  204.  }else if(percent2 > 5 && percent2 < 7){
  205.      if(BUTTON_PRESSED2){
  206.       tone(BUZZER_PIN, NOTE_DS1);
  207.     }else{
  208.       noTone(BUZZER_PIN);
  209.     }
  210.  }else if(percent2 > 6 && percent2 < 8){
  211.      if(BUTTON_PRESSED2){
  212.       tone(BUZZER_PIN, NOTE_E1);
  213.     }else{
  214.       noTone(BUZZER_PIN);
  215.     }
  216.  }else if(percent2 > 7 && percent2 < 9){
  217.      if(BUTTON_PRESSED2){
  218.       tone(BUZZER_PIN, NOTE_F1);
  219.     }else{
  220.       noTone(BUZZER_PIN);
  221.     }
  222.  }else if(percent2 > 8 && percent2 < 10){
  223.      if(BUTTON_PRESSED2){
  224.       tone(BUZZER_PIN, NOTE_FS1);
  225.     }else{
  226.       noTone(BUZZER_PIN);
  227.     }
  228.  }else if(percent2 > 9 && percent2 < 11){
  229.      if(BUTTON_PRESSED2){
  230.       tone(BUZZER_PIN, NOTE_G1);
  231.     }else{
  232.       noTone(BUZZER_PIN);
  233.     }
  234.  }else if(percent2 > 10 && percent2 < 12){
  235.      if(BUTTON_PRESSED2){
  236.       tone(BUZZER_PIN, NOTE_GS1);
  237.     }else{
  238.       noTone(BUZZER_PIN);
  239.     }
  240.  }else if(percent2 > 11 && percent2 < 13){
  241.      if(BUTTON_PRESSED2){
  242.       tone(BUZZER_PIN, NOTE_A1);
  243.     }else{
  244.       noTone(BUZZER_PIN);
  245.     }
  246.  }else if(percent2 > 12 && percent2 < 14){
  247.      if(BUTTON_PRESSED2){
  248.       tone(BUZZER_PIN, NOTE_AS1);
  249.     }else{
  250.       noTone(BUZZER_PIN);
  251.     }
  252.  }else if(percent2 > 13 && percent2 < 15){
  253.      if(BUTTON_PRESSED2){
  254.       tone(BUZZER_PIN, NOTE_B1);
  255.     }else{
  256.       noTone(BUZZER_PIN);
  257.     }
  258.  }else if(percent2 > 14 && percent2 < 16){
  259.      if(BUTTON_PRESSED2){
  260.       tone(BUZZER_PIN, NOTE_C2);
  261.     }else{
  262.       noTone(BUZZER_PIN);
  263.     }
  264.  }else if(percent2 > 15 && percent2 < 17){
  265.      if(BUTTON_PRESSED2){
  266.       tone(BUZZER_PIN, NOTE_CS2);
  267.     }else{
  268.       noTone(BUZZER_PIN);
  269.     }
  270.  }else if(percent2 > 16 && percent2 < 18){
  271.      if(BUTTON_PRESSED2){
  272.       tone(BUZZER_PIN, NOTE_D2);
  273.     }else{
  274.       noTone(BUZZER_PIN);
  275.     }
  276.  }else if(percent2 > 17 && percent2 < 19){
  277.      if(BUTTON_PRESSED2){
  278.       tone(BUZZER_PIN, NOTE_DS2);
  279.     }else{
  280.       noTone(BUZZER_PIN);
  281.     }
  282.  }else if(percent2 > 18 && percent2 < 20){
  283.      if(BUTTON_PRESSED2){
  284.       tone(BUZZER_PIN, NOTE_E2);
  285.     }else{
  286.       noTone(BUZZER_PIN);
  287.     }
  288.  }else if(percent2 > 19 && percent2 < 21){
  289.      if(BUTTON_PRESSED2){
  290.       tone(BUZZER_PIN, NOTE_F2);
  291.     }else{
  292.       noTone(BUZZER_PIN);
  293.     }
  294.  }else if(percent2 > 20 && percent2 < 22){
  295.      if(BUTTON_PRESSED2){
  296.       tone(BUZZER_PIN, NOTE_FS2);
  297.     }else{
  298.       noTone(BUZZER_PIN);
  299.     }
  300.  }else if(percent2 > 21 && percent2 < 23){
  301.      if(BUTTON_PRESSED2){
  302.       tone(BUZZER_PIN, NOTE_G2);
  303.     }else{
  304.       noTone(BUZZER_PIN);
  305.     }
  306.  }else if(percent2 > 22 && percent2 < 24){
  307.      if(BUTTON_PRESSED2){
  308.       tone(BUZZER_PIN, NOTE_GS2);
  309.     }else{
  310.       noTone(BUZZER_PIN);
  311.     }
  312.  }else if(percent2 > 23 && percent2 < 25){
  313.      if(BUTTON_PRESSED2){
  314.       tone(BUZZER_PIN, NOTE_A2);
  315.     }else{
  316.       noTone(BUZZER_PIN);
  317.     }
  318.  }else if(percent2 > 24 && percent2 < 26){
  319.      if(BUTTON_PRESSED2){
  320.       tone(BUZZER_PIN, NOTE_AS2);
  321.     }else{
  322.       noTone(BUZZER_PIN);
  323.     }
  324.  }else if(percent2 > 25 && percent2 < 27){
  325.      if(BUTTON_PRESSED2){
  326.       tone(BUZZER_PIN, NOTE_B2);
  327.     }else{
  328.       noTone(BUZZER_PIN);
  329.     }
  330.  }else if(percent2 > 26 && percent2 < 28){
  331.      if(BUTTON_PRESSED2){
  332.       tone(BUZZER_PIN, NOTE_C3);
  333.     }else{
  334.       noTone(BUZZER_PIN);
  335.     }
  336.  }else if(percent2 > 27 && percent2 < 29){
  337.      if(BUTTON_PRESSED2){
  338.       tone(BUZZER_PIN, NOTE_CS3);
  339.     }else{
  340.       noTone(BUZZER_PIN);
  341.     }
  342.  }else if(percent2 > 28 && percent2 < 30){
  343.      if(BUTTON_PRESSED2){
  344.       tone(BUZZER_PIN, NOTE_D3);
  345.     }else{
  346.       noTone(BUZZER_PIN);
  347.     }
  348.  }else if(percent2 > 29 && percent2 < 31){
  349.      if(BUTTON_PRESSED2){
  350.       tone(BUZZER_PIN, NOTE_DS3);
  351.     }else{
  352.       noTone(BUZZER_PIN);
  353.     }
  354.  }else if(percent2 > 30 && percent2 < 32){
  355.      if(BUTTON_PRESSED2){
  356.       tone(BUZZER_PIN, NOTE_E3);
  357.     }else{
  358.       noTone(BUZZER_PIN);
  359.     }
  360.  }else if(percent2 > 31 && percent2 < 33){
  361.      if(BUTTON_PRESSED2){
  362.       tone(BUZZER_PIN, NOTE_F3);
  363.     }else{
  364.       noTone(BUZZER_PIN);
  365.     }
  366.  }else if(percent2 > 32 && percent2 < 34){
  367.      if(BUTTON_PRESSED2){
  368.       tone(BUZZER_PIN, NOTE_FS3);
  369.     }else{
  370.       noTone(BUZZER_PIN);
  371.     }
  372.  }else if(percent2 > 33 && percent2 < 35){
  373.      if(BUTTON_PRESSED2){
  374.       tone(BUZZER_PIN, NOTE_G3);
  375.     }else{
  376.       noTone(BUZZER_PIN);
  377.     }
  378.  }else if(percent2 > 34 && percent2 < 36){
  379.      if(BUTTON_PRESSED2){
  380.       tone(BUZZER_PIN, NOTE_GS3);
  381.     }else{
  382.       noTone(BUZZER_PIN);
  383.     }
  384.  }else if(percent2 > 35 && percent2 < 37){
  385.      if(BUTTON_PRESSED2){
  386.       tone(BUZZER_PIN, NOTE_A3);
  387.     }else{
  388.       noTone(BUZZER_PIN);
  389.     }
  390.  }else if(percent2 > 36 && percent2 < 38){
  391.      if(BUTTON_PRESSED2){
  392.       tone(BUZZER_PIN, NOTE_AS3);
  393.     }else{
  394.       noTone(BUZZER_PIN);
  395.     }
  396.  }else if(percent2 > 37 && percent2 < 39){
  397.      if(BUTTON_PRESSED2){
  398.       tone(BUZZER_PIN, NOTE_B3);
  399.     }else{
  400.       noTone(BUZZER_PIN);
  401.     }
  402.  }else if(percent2 > 38 && percent2 < 40){
  403.      if(BUTTON_PRESSED2){
  404.       tone(BUZZER_PIN, NOTE_C4);
  405.     }else{
  406.       noTone(BUZZER_PIN);
  407.     }
  408.  }else if(percent2 > 39 && percent2 < 41){
  409.      if(BUTTON_PRESSED2){
  410.       tone(BUZZER_PIN, NOTE_CS4);
  411.     }else{
  412.       noTone(BUZZER_PIN);
  413.     }
  414.  }else if(percent2 > 40 && percent2 < 42){
  415.      if(BUTTON_PRESSED2){
  416.       tone(BUZZER_PIN, NOTE_D4);
  417.     }else{
  418.       noTone(BUZZER_PIN);
  419.     }
  420.  }else if(percent2 > 41 && percent2 < 43){
  421.      if(BUTTON_PRESSED2){
  422.       tone(BUZZER_PIN, NOTE_DS4);
  423.     }else{
  424.       noTone(BUZZER_PIN);
  425.     }
  426.  }else if(percent2 > 42 && percent2 < 44){
  427.      if(BUTTON_PRESSED2){
  428.       tone(BUZZER_PIN, NOTE_E4);
  429.     }else{
  430.       noTone(BUZZER_PIN);
  431.     }
  432.  }else if(percent2 > 43 && percent2 < 45){
  433.      if(BUTTON_PRESSED2){
  434.       tone(BUZZER_PIN, NOTE_F4);
  435.     }else{
  436.       noTone(BUZZER_PIN);
  437.     }
  438.  }else if(percent2 > 44 && percent2 < 46){
  439.      if(BUTTON_PRESSED2){
  440.       tone(BUZZER_PIN, NOTE_FS4);
  441.     }else{
  442.       noTone(BUZZER_PIN);
  443.     }
  444.  }else if(percent2 > 45 && percent2 < 47){
  445.      if(BUTTON_PRESSED2){
  446.       tone(BUZZER_PIN, NOTE_G4);
  447.     }else{
  448.       noTone(BUZZER_PIN);
  449.     }
  450.  }else if(percent2 > 46 && percent2 < 48){
  451.      if(BUTTON_PRESSED2){
  452.       tone(BUZZER_PIN, NOTE_GS4);
  453.     }else{
  454.       noTone(BUZZER_PIN);
  455.     }
  456.  }else if(percent2 > 47 && percent2 < 49){
  457.      if(BUTTON_PRESSED2){
  458.       tone(BUZZER_PIN, NOTE_A4);
  459.     }else{
  460.       noTone(BUZZER_PIN);
  461.     }
  462.  }else if(percent2 > 48 && percent2 < 50){
  463.      if(BUTTON_PRESSED2){
  464.       tone(BUZZER_PIN, NOTE_AS4);
  465.     }else{
  466.       noTone(BUZZER_PIN);
  467.     }
  468.  }else if(percent2 > 49 && percent2 < 51){
  469.      if(BUTTON_PRESSED2){
  470.       tone(BUZZER_PIN, NOTE_B4);
  471.     }else{
  472.       noTone(BUZZER_PIN);
  473.     }
  474.  }else if(percent2 > 50 && percent2 < 52){
  475.      if(BUTTON_PRESSED2){
  476.       tone(BUZZER_PIN, NOTE_C5);
  477.     }else{
  478.       noTone(BUZZER_PIN);
  479.     }
  480.  }else if(percent2 > 51 && percent2 < 53){
  481.      if(BUTTON_PRESSED2){
  482.       tone(BUZZER_PIN, NOTE_CS5);
  483.     }else{
  484.       noTone(BUZZER_PIN);
  485.     }
  486.  }else if(percent2 > 52 && percent2 < 54){
  487.      if(BUTTON_PRESSED2){
  488.       tone(BUZZER_PIN, NOTE_D5);
  489.     }else{
  490.       noTone(BUZZER_PIN);
  491.     }
  492.  }else if(percent2 > 53 && percent2 < 55){
  493.      if(BUTTON_PRESSED2){
  494.       tone(BUZZER_PIN, NOTE_DS5);
  495.     }else{
  496.       noTone(BUZZER_PIN);
  497.     }
  498.  }else if(percent2 > 54 && percent2 < 56){
  499.      if(BUTTON_PRESSED2){
  500.       tone(BUZZER_PIN, NOTE_E5);
  501.     }else{
  502.       noTone(BUZZER_PIN);
  503.     }
  504.  }else if(percent2 > 55 && percent2 < 57){
  505.      if(BUTTON_PRESSED2){
  506.       tone(BUZZER_PIN, NOTE_F5);
  507.     }else{
  508.       noTone(BUZZER_PIN);
  509.     }
  510.  }else if(percent2 > 56 && percent2 < 58){
  511.      if(BUTTON_PRESSED2){
  512.       tone(BUZZER_PIN, NOTE_FS5);
  513.     }else{
  514.       noTone(BUZZER_PIN);
  515.     }
  516.  }else if(percent2 > 57 && percent2 < 59){
  517.      if(BUTTON_PRESSED2){
  518.       tone(BUZZER_PIN, NOTE_G5);
  519.     }else{
  520.       noTone(BUZZER_PIN);
  521.     }
  522.  }else if(percent2 > 58 && percent2 < 60){
  523.      if(BUTTON_PRESSED2){
  524.       tone(BUZZER_PIN, NOTE_GS5);
  525.     }else{
  526.       noTone(BUZZER_PIN);
  527.     }
  528.  }else if(percent2 > 59 && percent2 < 61){
  529.      if(BUTTON_PRESSED2){
  530.       tone(BUZZER_PIN, NOTE_A5);
  531.     }else{
  532.       noTone(BUZZER_PIN);
  533.     }
  534.  }else if(percent2 > 60 && percent2 < 62){
  535.      if(BUTTON_PRESSED2){
  536.       tone(BUZZER_PIN, NOTE_AS5);
  537.     }else{
  538.       noTone(BUZZER_PIN);
  539.     }
  540.  }else if(percent2 > 61 && percent2 < 63){
  541.      if(BUTTON_PRESSED2){
  542.       tone(BUZZER_PIN, NOTE_B5);
  543.     }else{
  544.       noTone(BUZZER_PIN);
  545.     }
  546.  }else if(percent2 > 62 && percent2 < 64){
  547.      if(BUTTON_PRESSED2){
  548.       tone(BUZZER_PIN, NOTE_C6);
  549.     }else{
  550.       noTone(BUZZER_PIN);
  551.     }
  552.  }else if(percent2 > 63 && percent2 < 65){
  553.      if(BUTTON_PRESSED2){
  554.       tone(BUZZER_PIN, NOTE_CS6);
  555.     }else{
  556.       noTone(BUZZER_PIN);
  557.     }
  558.  }else if(percent2 > 64 && percent2 < 66){
  559.      if(BUTTON_PRESSED2){
  560.       tone(BUZZER_PIN, NOTE_D6);
  561.     }else{
  562.       noTone(BUZZER_PIN);
  563.     }
  564.  }else if(percent2 > 65 && percent2 < 67){
  565.      if(BUTTON_PRESSED2){
  566.       tone(BUZZER_PIN, NOTE_DS6);
  567.     }else{
  568.       noTone(BUZZER_PIN);
  569.     }
  570.  }else if(percent2 > 66 && percent2 < 68){
  571.      if(BUTTON_PRESSED2){
  572.       tone(BUZZER_PIN, NOTE_E6);
  573.     }else{
  574.       noTone(BUZZER_PIN);
  575.     }
  576.  }else if(percent2 > 67 && percent2 < 69){
  577.      if(BUTTON_PRESSED2){
  578.       tone(BUZZER_PIN, NOTE_F6);
  579.     }else{
  580.       noTone(BUZZER_PIN);
  581.     }
  582.  }else if(percent2 > 68 && percent2 < 70){
  583.      if(BUTTON_PRESSED2){
  584.       tone(BUZZER_PIN, NOTE_FS6);
  585.     }else{
  586.       noTone(BUZZER_PIN);
  587.     }
  588.  }else if(percent2 > 69 && percent2 < 71){
  589.      if(BUTTON_PRESSED2){
  590.       tone(BUZZER_PIN, NOTE_G6);
  591.     }else{
  592.       noTone(BUZZER_PIN);
  593.     }
  594.  }else if(percent2 > 70 && percent2 < 72){
  595.      if(BUTTON_PRESSED2){
  596.       tone(BUZZER_PIN, NOTE_GS6);
  597.     }else{
  598.       noTone(BUZZER_PIN);
  599.     }
  600.  }else if(percent2 > 71 && percent2 < 73){
  601.      if(BUTTON_PRESSED2){
  602.       tone(BUZZER_PIN, NOTE_A6);
  603.     }else{
  604.       noTone(BUZZER_PIN);
  605.     }
  606.  }else if(percent2 > 72 && percent2 < 74){
  607.      if(BUTTON_PRESSED2){
  608.       tone(BUZZER_PIN, NOTE_AS6);
  609.     }else{
  610.       noTone(BUZZER_PIN);
  611.     }
  612.  }else if(percent2 > 73 && percent2 < 75){
  613.      if(BUTTON_PRESSED2){
  614.       tone(BUZZER_PIN, NOTE_B6);
  615.     }else{
  616.       noTone(BUZZER_PIN);
  617.     }
  618.  }else if(percent2 > 74 && percent2 < 76){
  619.      if(BUTTON_PRESSED2){
  620.       tone(BUZZER_PIN, NOTE_C7);
  621.     }else{
  622.       noTone(BUZZER_PIN);
  623.     }
  624.  }else if(percent2 > 75 && percent2 < 77){
  625.      if(BUTTON_PRESSED2){
  626.       tone(BUZZER_PIN, NOTE_CS7);
  627.     }else{
  628.       noTone(BUZZER_PIN);
  629.     }
  630.  }else if(percent2 > 76 && percent2 < 78){
  631.      if(BUTTON_PRESSED2){
  632.       tone(BUZZER_PIN, NOTE_D7);
  633.     }else{
  634.       noTone(BUZZER_PIN);
  635.     }
  636.  }else if(percent2 > 77 && percent2 < 79){
  637.      if(BUTTON_PRESSED2){
  638.       tone(BUZZER_PIN, NOTE_DS7);
  639.     }else{
  640.       noTone(BUZZER_PIN);
  641.     }
  642.  }else if(percent2 > 78 && percent2 < 80){
  643.      if(BUTTON_PRESSED2){
  644.       tone(BUZZER_PIN, NOTE_E7);
  645.     }else{
  646.       noTone(BUZZER_PIN);
  647.     }
  648.  }else if(percent2 > 79 && percent2 < 81){
  649.      if(BUTTON_PRESSED2){
  650.       tone(BUZZER_PIN, NOTE_F7);
  651.     }else{
  652.       noTone(BUZZER_PIN);
  653.     }
  654.  }else if(percent2 > 80 && percent2 < 82){
  655.      if(BUTTON_PRESSED2){
  656.       tone(BUZZER_PIN, NOTE_FS7);
  657.     }else{
  658.       noTone(BUZZER_PIN);
  659.     }
  660.  }else if(percent2 > 81 && percent2 < 83){
  661.      if(BUTTON_PRESSED2){
  662.       tone(BUZZER_PIN, NOTE_G7);
  663.     }else{
  664.       noTone(BUZZER_PIN);
  665.     }
  666.  }else if(percent2 > 82 && percent2 < 84){
  667.      if(BUTTON_PRESSED2){
  668.       tone(BUZZER_PIN, NOTE_GS7);
  669.     }else{
  670.       noTone(BUZZER_PIN);
  671.     }
  672.  }else if(percent2 > 83 && percent2 < 85){
  673.      if(BUTTON_PRESSED2){
  674.       tone(BUZZER_PIN, NOTE_A7);
  675.     }else{
  676.       noTone(BUZZER_PIN);
  677.     }
  678.  }else if(percent2 > 84 && percent2 < 86){
  679.      if(BUTTON_PRESSED2){
  680.       tone(BUZZER_PIN, NOTE_AS7);
  681.     }else{
  682.       noTone(BUZZER_PIN);
  683.     }
  684.  }else if(percent2 > 85 && percent2 < 87){
  685.      if(BUTTON_PRESSED2){
  686.       tone(BUZZER_PIN, NOTE_B7);
  687.     }else{
  688.       noTone(BUZZER_PIN);
  689.     }
  690.  }else if(percent2 > 86 && percent2 < 88){
  691.      if(BUTTON_PRESSED2){
  692.       tone(BUZZER_PIN, NOTE_C8);
  693.     }else{
  694.       noTone(BUZZER_PIN);
  695.     }
  696.  }else if(percent2 > 87 && percent2 < 89){
  697.      if(BUTTON_PRESSED2){
  698.       tone(BUZZER_PIN, NOTE_CS8);
  699.     }else{
  700.       noTone(BUZZER_PIN);
  701.     }
  702.  }else if(percent2 > 88 && percent2 < 90){
  703.      if(BUTTON_PRESSED2){
  704.       tone(BUZZER_PIN, NOTE_D8);
  705.     }else{
  706.       noTone(BUZZER_PIN);
  707.     }
  708.  }else if(percent2 > 89 && percent2 < 91){
  709.      if(BUTTON_PRESSED2){
  710.       tone(BUZZER_PIN, NOTE_DS8);
  711.     }else{
  712.       noTone(BUZZER_PIN);
  713.     }
  714.  }else if(percent2 > 90 && percent2 <= 100){
  715.      if(BUTTON_PRESSED2){
  716.     //  tone(BUZZER_PIN, NOTE_DS8);
  717. // iterate over the notes of the melody:
  718.   for (int thisNote = 0; thisNote < 24; thisNote++) {
  719.  
  720.     // to calculate the note duration, take one second divided by the note type.
  721.     //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
  722.     int noteDuration = 1000 / noteDurations[thisNote];
  723.     tone(BUZZER_PIN, melody[thisNote], noteDuration);
  724.  
  725.     // to distinguish the notes, set a minimum time between them.
  726.     // the note's duration + 30% seems to work well:
  727.     int pauseBetweenNotes = noteDuration * 1.30;
  728.     delay(pauseBetweenNotes);
  729.     // stop the tone playing:
  730.     noTone(BUZZER_PIN);
  731.   }
  732.    
  733.     }else{
  734.       noTone(BUZZER_PIN);
  735.     }
  736.  }
  737.  
  738.  
  739.    
  740.  if(percent >= 0 && percent <= 8){ //between 0 and 4
  741.   //draw1();
  742.    if(BUTTON_PRESSED){
  743.       //create variables to store color values
  744.       //write a line that
  745.       //digitalWrite(LED, HIGH); //LED ON
  746.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 255));
  747.       pxl.show();
  748.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 255));
  749.       pxl2.show();
  750.     }else{
  751.       //digitalWrite(LED, LOW); //LED OFF  
  752.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  753.       pxl.show();
  754.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  755.       pxl2.show();
  756.  }
  757.  
  758.  }else if(percent >= 9 && percent <= 16){
  759.   //draw2();
  760.  if(BUTTON_PRESSED){
  761.       //create variables to store color values
  762.       //write a line that
  763.       //digitalWrite(LED, HIGH); //LED ON
  764.       pxl.setPixelColor(PXL1[0], pxl.Color(128, 0, 255));
  765.       pxl.show();
  766.       pxl2.setPixelColor(PXL2[0], pxl2.Color(128, 0, 255));
  767.       pxl2.show();
  768.     }else{
  769.       //digitalWrite(LED, LOW); //LED OFF  
  770.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  771.       pxl.show();
  772.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  773.       pxl2.show();
  774.  }
  775.  
  776.   }else if(percent >= 17 && percent <= 24){
  777.      if(BUTTON_PRESSED){
  778.       //create variables to store color values
  779.       //write a line that
  780.       //digitalWrite(LED, HIGH); //LED ON
  781.       pxl.setPixelColor(PXL1[0], pxl.Color(255, 0, 255));
  782.       pxl.show();
  783.       pxl2.setPixelColor(PXL2[0], pxl2.Color(255, 0, 255));
  784.       pxl2.show();
  785.     }else{
  786.       //digitalWrite(LED, LOW); //LED OFF  
  787.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  788.       pxl.show();
  789.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  790.       pxl2.show();
  791.     }
  792.  }else if(percent >= 25 && percent <= 32){
  793.      if(BUTTON_PRESSED){
  794.       //create variables to store color values
  795.       //write a line that
  796.       //digitalWrite(LED, HIGH); //LED ON
  797.       pxl.setPixelColor(PXL1[0], pxl.Color(255, 0, 128));
  798.       pxl.show();
  799.       pxl2.setPixelColor(PXL2[0], pxl2.Color(255, 0, 128));
  800.       pxl2.show();
  801.     }else{
  802.       //digitalWrite(LED, LOW); //LED OFF  
  803.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  804.       pxl.show();
  805.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  806.       pxl2.show();
  807.      
  808.  }
  809.  
  810. }else if(percent >= 33 && percent <= 40){
  811.      if(BUTTON_PRESSED){
  812.       //create variables to store color values
  813.       //write a line that
  814.       //digitalWrite(LED, HIGH); //LED ON
  815.       pxl.setPixelColor(PXL1[0], pxl.Color(255, 0, 0));
  816.       pxl.show();
  817.       pxl2.setPixelColor(PXL2[0], pxl2.Color(255, 0, 0));
  818.       pxl2.show();
  819.     }else{
  820.       //digitalWrite(LED, LOW); //LED OFF  
  821.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  822.       pxl.show();
  823.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  824.       pxl2.show();
  825.      
  826.  }
  827.  
  828.  }else if(percent >= 41 && percent <= 48){
  829.      if(BUTTON_PRESSED){
  830.       //create variables to store color values
  831.       //write a line that
  832.       //digitalWrite(LED, HIGH); //LED ON
  833.       pxl.setPixelColor(PXL1[0], pxl.Color(255, 128, 0));
  834.       pxl.show();
  835.       pxl2.setPixelColor(PXL2[0], pxl2.Color(255, 128, 0));
  836.       pxl2.show();
  837.     }else{
  838.       //digitalWrite(LED, LOW); //LED OFF  
  839.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  840.       pxl.show();
  841.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  842.       pxl2.show();
  843.      
  844.  }
  845.  
  846.  }else if(percent >= 49 && percent <= 56){
  847.      if(BUTTON_PRESSED){
  848.       //create variables to store color values
  849.       //write a line that
  850.       //digitalWrite(LED, HIGH); //LED ON
  851.       pxl.setPixelColor(PXL1[0], pxl.Color(255, 255, 0));
  852.       pxl.show();
  853.       pxl2.setPixelColor(PXL2[0], pxl2.Color(255, 255, 0));
  854.       pxl2.show();
  855.     }else{
  856.       //digitalWrite(LED, LOW); //LED OFF  
  857.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  858.       pxl.show();
  859.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  860.       pxl2.show();
  861.      
  862.  }
  863.  
  864.  }else if(percent >= 57 && percent <= 64){
  865.      if(BUTTON_PRESSED){
  866.       //create variables to store color values
  867.       //write a line that
  868.       //digitalWrite(LED, HIGH); //LED ON
  869.       pxl.setPixelColor(PXL1[0], pxl.Color(128, 255, 0));
  870.       pxl.show();
  871.       pxl2.setPixelColor(PXL2[0], pxl2.Color(128, 255, 0));
  872.       pxl2.show();
  873.     }else{
  874.       //digitalWrite(LED, LOW); //LED OFF  
  875.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  876.       pxl.show();
  877.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  878.       pxl2.show();
  879.  }
  880.  
  881.  }else if(percent >= 65 && percent <= 72){
  882.      if(BUTTON_PRESSED){
  883.       //create variables to store color values
  884.       //write a line that
  885.       //digitalWrite(LED, HIGH); //LED ON
  886.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 255, 0));
  887.       pxl.show();
  888.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 255, 0));
  889.       pxl2.show();
  890.     }else{
  891.       //digitalWrite(LED, LOW); //LED OFF  
  892.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  893.       pxl.show();
  894.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  895.       pxl2.show();
  896.  }
  897.  
  898.  }else if(percent >= 73 && percent <= 80){
  899.      if(BUTTON_PRESSED){
  900.       //create variables to store color values
  901.       //write a line that
  902.       //digitalWrite(LED, HIGH); //LED ON
  903.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 255, 128));
  904.       pxl.show();
  905.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 255, 128));
  906.       pxl2.show();
  907.     }else{
  908.       //digitalWrite(LED, LOW); //LED OFF  
  909.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  910.       pxl.show();
  911.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  912.       pxl2.show();
  913.      
  914.  }
  915.  
  916.  }else if(percent >= 81 && percent <= 88){
  917.      if(BUTTON_PRESSED){
  918.       //create variables to store color values
  919.       //write a line that
  920.       //digitalWrite(LED, HIGH); //LED ON
  921.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 255, 255));
  922.       pxl.show();
  923.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 255, 255));
  924.       pxl2.show();
  925.     }else{
  926.       //digitalWrite(LED, LOW); //LED OFF  
  927.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  928.       pxl.show();
  929.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  930.       pxl2.show();
  931.      
  932.  }
  933.  
  934.  }else if(percent >= 89 && percent <= 95){
  935.      if(BUTTON_PRESSED){
  936.       //create variables to store color values
  937.       //then write a line that tells the LED to shine or "show"
  938.       //digitalWrite(LED, HIGH); //LED ON
  939.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 128, 255));
  940.       pxl.show();
  941.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 128, 255));
  942.       pxl2.show();
  943.     }else{
  944.       //digitalWrite(LED, LOW); //LED OFF  
  945.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  946.       pxl.show();
  947.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  948.       pxl2.show();
  949.      
  950.  }
  951.  
  952.  }else if(percent >= 96 && percent <= 98){
  953.      if(BUTTON_PRESSED){
  954.       //create variables to store color values
  955.       //then write a line that tells the LED to shine or "show"
  956.       //digitalWrite(LED, HIGH); //LED ON
  957.       pxl.setPixelColor(PXL1[0], pxl.Color(255, 255, 255));
  958.       pxl.show();
  959.       pxl2.setPixelColor(PXL2[0], pxl2.Color(255, 255, 255));
  960.       pxl2.show();
  961.     }else{
  962.       //digitalWrite(LED, LOW); //LED OFF  
  963.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  964.       pxl.show();
  965.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  966.       pxl2.show();
  967.  }
  968.  
  969.  }else if(percent >= 99 && percent <= 100){
  970.      if(BUTTON_PRESSED){
  971.  
  972.  
  973.    rainbow(4);
  974.   // rainbow2(4);
  975.    
  976.     }else{
  977.       //digitalWrite(LED, LOW); //LED OFF  
  978.       pxl.setPixelColor(PXL1[0], pxl.Color(0, 0, 0));
  979.       pxl.show();
  980.       pxl2.setPixelColor(PXL2[0], pxl2.Color(0, 0, 0));
  981.       pxl2.show();
  982.  }
  983.  
  984.  }
  985.  
  986.  
  987.  
  988.    
  989.  
  990.  
  991.     }
  992.  
  993.     void rainbow(int wait) {
  994.   // Hue of first pixel runs 5 complete loops through the color wheel.
  995.   // Color wheel has a range of 65536 but it's OK if we roll over, so
  996.   // just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
  997.   // means we'll make 5*65536/256 = 1280 passes through this loop:
  998.   for(long firstPixelHue = 5*65536; firstPixelHue > 0; firstPixelHue -= 256) {
  999.     // strip.rainbow() can take a single argument (first pixel hue) or
  1000.     // optionally a few extras: number of rainbow repetitions (default 1),
  1001.     // saturation and value (brightness) (both 0-255, similar to the
  1002.     // ColorHSV() function, default 255), and a true/false flag for whether
  1003.     // to apply gamma correction to provide 'truer' colors (default true).
  1004.     pxl.rainbow(firstPixelHue);
  1005.  
  1006.     pxl2.rainbow(firstPixelHue);
  1007.     // Above line is equivalent to:
  1008.     // strip.rainbow(firstPixelHue, 1, 255, 255, true);
  1009.     pxl.show(); // Update strip with new contents
  1010.     pxl2.show(); // Update strip with new contents
  1011.     delay(wait);  // Pause for a moment
  1012.    
  1013.   }
  1014.     }
  1015.      
  1016.    
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Yavunto
    19 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • Axwoldy
    14 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
Add Comment
Please, Sign In to add comment