Advertisement
deltatask1

FULL Game of Thrones Theme Song on Arduino

May 28th, 2015
5,997
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.75 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////
  2. //
  3. // GAME OF THRONES THEME SONG
  4. // PERFORMED ON PIEZO SENSOR AND 3 LEDS
  5. // WRITTEN BY
  6. // KALEB HILL
  7. // 5/28/15
  8. //
  9. ////////////////////////////////////////////////////////////////////////
  10.  
  11. int ledred = 9; // the pin that the LED is attached to
  12. int ledblue = 10;
  13. int ledgreen = 11;
  14. int brightness = 255; // how bright the LED is
  15. int fadeAmount = 5; // how many points to fade the LED by
  16.  
  17. // the setup routine runs once when you press reset:
  18. void setup() {
  19. // declare pin 9 to be an output:
  20. pinMode(ledred, OUTPUT);
  21. pinMode(ledblue, OUTPUT);
  22. pinMode(ledgreen, OUTPUT);
  23. pinMode(A0, OUTPUT);
  24. }
  25.  
  26. // the loop routine runs over and over again forever:
  27.  
  28. void loop (){
  29.  
  30.  
  31.  
  32. //G3
  33. analogWrite(ledred, 255);
  34. analogWrite(ledblue, 255);
  35. analogWrite(ledgreen, 255);
  36. tone(A0, 196, 375);
  37. delay(400);
  38.  
  39.  
  40. ////////////////////////////////ONE
  41.  
  42. //C3
  43. analogWrite(ledred, LOW);
  44. analogWrite(ledblue, LOW);
  45. analogWrite(ledgreen, LOW);
  46. tone(A0, 131, 375);
  47. delay(400);
  48.  
  49. //DS3
  50. analogWrite(ledblue, 255);
  51. tone(A0, 156, 175);
  52. delay(200);
  53.  
  54. //F3
  55. analogWrite(ledred, 255);
  56. tone(A0, 175, 175);
  57. delay(200);
  58.  
  59. //G3
  60. analogWrite(ledgreen, 255);
  61. tone(A0, 196, 375);
  62. delay(400);
  63.  
  64. ////////////////////////////////TWO
  65.  
  66. //C3
  67. analogWrite(ledred, LOW);
  68. analogWrite(ledblue, LOW);
  69. analogWrite(ledgreen, LOW);
  70. tone(A0, 131, 375);
  71. delay(400);
  72.  
  73. //DS3
  74. analogWrite(ledblue, 255);
  75. tone(A0, 156, 175);
  76. delay(200);
  77.  
  78. //F3
  79. analogWrite(ledred, 255);
  80. tone(A0, 175, 175);
  81. delay(200);
  82.  
  83. //G3
  84. analogWrite(ledgreen, 255);
  85. tone(A0, 196, 375);
  86. delay(400);
  87.  
  88. //////////////////////////////THREE
  89.  
  90. //C3
  91. analogWrite(ledred, LOW);
  92. analogWrite(ledblue, LOW);
  93. analogWrite(ledgreen, LOW);
  94. tone(A0, 131, 375);
  95. delay(400);
  96.  
  97. //DS3
  98. analogWrite(ledblue, 255);
  99. tone(A0, 156, 175);
  100. delay(200);
  101.  
  102. //F3
  103. analogWrite(ledred, 255);
  104. tone(A0, 175, 175);
  105. delay(200);
  106.  
  107. //G3
  108. analogWrite(ledgreen, 255);
  109. tone(A0, 196, 375);
  110. delay(400);
  111.  
  112. ///////////////////////////////FOUR
  113.  
  114. //C3
  115. analogWrite(ledred, LOW);
  116. analogWrite(ledblue, LOW);
  117. analogWrite(ledgreen, LOW);
  118. tone(A0, 131, 375);
  119. delay(400);
  120.  
  121. //DS3
  122. analogWrite(ledblue, 255);
  123. tone(A0, 156, 175);
  124. delay(200);
  125.  
  126. //F3
  127. analogWrite(ledred, 255);
  128. tone(A0, 175, 175);
  129. delay(200);
  130.  
  131. //G3
  132. analogWrite(ledgreen, 255);
  133. tone(A0, 196, 375);
  134. delay(400);
  135.  
  136. ///////////////////////////////FIVE
  137.  
  138. //C3
  139. analogWrite(ledred, LOW);
  140. analogWrite(ledblue, LOW);
  141. analogWrite(ledgreen, LOW);
  142. tone(A0, 131, 375);
  143. delay(400);
  144.  
  145. //E3
  146. analogWrite(ledblue, 255);
  147. tone(A0, 165, 175);
  148. delay(200);
  149.  
  150. //F3
  151. analogWrite(ledred, 255);
  152. tone(A0, 175, 175);
  153. delay(200);
  154.  
  155. //G3
  156. analogWrite(ledgreen, 255);
  157. tone(A0, 196, 375);
  158. delay(400);
  159.  
  160. ///////////////////////////////SIX
  161.  
  162. //C3
  163. analogWrite(ledred, LOW);
  164. analogWrite(ledblue, LOW);
  165. analogWrite(ledgreen, LOW);
  166. tone(A0, 131, 375);
  167. delay(400);
  168.  
  169. //DS3
  170. analogWrite(ledblue, 255);
  171. tone(A0, 156, 175);
  172. delay(200);
  173.  
  174. //F3
  175. analogWrite(ledred, 255);
  176. tone(A0, 175, 175);
  177. delay(200);
  178.  
  179. //G3
  180. analogWrite(ledgreen, 255);
  181. tone(A0, 196, 375);
  182. delay(400);
  183.  
  184. //////////////////////////////SEVEN
  185.  
  186. //C3
  187. analogWrite(ledred, LOW);
  188. analogWrite(ledblue, LOW);
  189. analogWrite(ledgreen, LOW);
  190. tone(A0, 131, 375);
  191. delay(400);
  192.  
  193. //E3
  194. analogWrite(ledblue, 255);
  195. tone(A0, 165, 175);
  196. delay(200);
  197. analogWrite(ledblue, LOW);
  198.  
  199. //F3
  200. analogWrite(ledred, 255);
  201. tone(A0, 175, 175);
  202. delay(200);
  203. analogWrite(ledred, LOW);
  204.  
  205. //G3
  206. analogWrite(ledgreen, 255);
  207. tone(A0, 196, 375);
  208. delay(400);
  209.  
  210.  
  211. //////////////////////////////EIGHT
  212.  
  213. //C3
  214. analogWrite(ledred, LOW);
  215. analogWrite(ledblue, LOW);
  216. analogWrite(ledgreen, LOW);
  217. tone(A0, 131, 375);
  218. delay(400);
  219.  
  220. //DS3
  221. analogWrite(ledblue, 255);
  222. tone(A0, 156, 175);
  223. delay(200);
  224.  
  225. //F3
  226. analogWrite(ledred, 255);
  227. tone(A0, 175, 175);
  228. delay(200);
  229.  
  230. /////////////////////////////////////////////////CHORUS1////////////////////////////////////////////
  231.  
  232.  
  233. //G4
  234. analogWrite(ledred, 255);
  235. tone(A0, 392, 1175);
  236. delay(1200);
  237. analogWrite(ledred, LOW);
  238.  
  239. //C4
  240. analogWrite(ledblue, 255);
  241. tone(A0, 262, 1175);
  242. delay(1200);
  243. analogWrite(ledblue, LOW);
  244.  
  245. //DS4
  246. analogWrite(ledred, 255);
  247. tone(A0, 311, 175);
  248. delay(200);
  249.  
  250. //F4
  251. analogWrite(ledblue, 255);
  252. tone(A0, 349, 175);
  253. delay(200);
  254.  
  255. //G4
  256. analogWrite(ledgreen, 255);
  257. tone(A0, 392, 775);
  258. delay(800);
  259.  
  260. //C4
  261. analogWrite(ledred, LOW);
  262. analogWrite(ledgreen, LOW);
  263. analogWrite(ledblue, LOW);
  264. tone(A0, 262, 775);
  265. delay(800);
  266.  
  267. //DS4
  268. analogWrite(ledred, 255);
  269. tone(A0, 311, 175);
  270. delay(200);
  271.  
  272. //F4
  273. analogWrite(ledblue, 255);
  274. tone(A0, 349, 175);
  275. delay(200);
  276.  
  277. //////////////////////////////
  278.  
  279. //C3
  280. analogWrite(ledred, LOW);
  281. analogWrite(ledblue, LOW);
  282. analogWrite(ledgreen, LOW);
  283. tone(A0, 131, 375);
  284. delay(400);
  285.  
  286. //DS3
  287. analogWrite(ledblue, 255);
  288. tone(A0, 156, 175);
  289. delay(200);
  290.  
  291. //F3
  292. analogWrite(ledred, 255);
  293. tone(A0, 175, 175);
  294. delay(200);
  295.  
  296. //G3
  297. analogWrite(ledgreen, 255);
  298. tone(A0, 196, 375);
  299. delay(400);
  300.  
  301. ///////////////////////////////
  302.  
  303. //C3
  304. analogWrite(ledred, LOW);
  305. analogWrite(ledblue, LOW);
  306. analogWrite(ledgreen, LOW);
  307. tone(A0, 131, 375);
  308. delay(400);
  309.  
  310. //DS3
  311. analogWrite(ledblue, 255);
  312. tone(A0, 156, 175);
  313. delay(200);
  314.  
  315. //F3
  316. analogWrite(ledred, 255);
  317. tone(A0, 175, 175);
  318. delay(200);
  319.  
  320. //G3
  321. analogWrite(ledgreen, 255);
  322. tone(A0, 196, 375);
  323. delay(400);
  324.  
  325.  
  326.  
  327. /////////////////////////////
  328.  
  329. //C3
  330. analogWrite(ledred, LOW);
  331. analogWrite(ledblue, LOW);
  332. analogWrite(ledgreen, LOW);
  333. tone(A0, 131, 375);
  334. delay(400);
  335.  
  336. //DS3
  337. analogWrite(ledblue, 255);
  338. tone(A0, 156, 175);
  339. delay(200);
  340.  
  341. //F3
  342. analogWrite(ledred, 255);
  343. tone(A0, 175, 175);
  344. delay(200);
  345.  
  346. //G3
  347. analogWrite(ledgreen, 255);
  348. tone(A0, 196, 375);
  349. delay(400);
  350.  
  351. /////////////////////////////
  352.  
  353. //C3
  354. analogWrite(ledred, LOW);
  355. analogWrite(ledblue, LOW);
  356. analogWrite(ledgreen, LOW);
  357. tone(A0, 131, 375);
  358. delay(400);
  359.  
  360. //DS3
  361. analogWrite(ledblue, 255);
  362. tone(A0, 156, 175);
  363. delay(200);
  364.  
  365. //F3
  366. analogWrite(ledred, 255);
  367. tone(A0, 175, 175);
  368. delay(200);
  369.  
  370. //G3
  371. analogWrite(ledgreen, 255);
  372. tone(A0, 196, 375);
  373. delay(400);
  374. while(brightness > 0)
  375. {
  376. analogWrite(ledred, brightness);
  377. analogWrite(ledblue, brightness);
  378. analogWrite(ledgreen, brightness);
  379. brightness = brightness - fadeAmount;
  380. if (brightness == 0 || brightness == 255) {
  381. fadeAmount = -fadeAmount ;
  382. }
  383. }
  384. analogWrite(ledred, LOW);
  385. analogWrite(ledgreen, LOW);
  386. analogWrite(ledblue, LOW);
  387. brightness = 255;
  388. fadeAmount = 5;
  389.  
  390.  
  391.  
  392.  
  393.  
  394. //F4
  395. analogWrite(ledred, 255);
  396. tone(A0, 349, 1175);
  397. delay(1200);
  398. analogWrite(ledred, LOW);
  399.  
  400. //AS4
  401. analogWrite(ledblue, 255);
  402. tone(A0, 233, 1175);
  403. delay(1200);
  404. analogWrite(ledblue, LOW);
  405.  
  406. //D4
  407. analogWrite(ledred, 255);
  408. tone(A0, 294, 175);
  409. delay(200);
  410.  
  411. //DS4
  412. analogWrite(ledblue, 255);
  413. tone(A0, 311, 175);
  414. delay(200);
  415.  
  416. //F4
  417. analogWrite(ledgreen, 255);
  418. tone(A0, 349, 775);
  419. delay(800);
  420.  
  421. //AS3
  422. analogWrite(ledred, LOW);
  423. analogWrite(ledgreen, LOW);
  424. analogWrite(ledblue, LOW);
  425. tone(A0, 233, 775);
  426. delay(800);
  427.  
  428. //DS4
  429. analogWrite(ledred, 255);
  430. tone(A0, 311, 175);
  431. delay(200);
  432.  
  433. //D4
  434. analogWrite(ledblue, 255);
  435. tone(A0, 294, 175);
  436. delay(200);
  437.  
  438. //////////////////////////////
  439.  
  440. //C3
  441. analogWrite(ledred, LOW);
  442. analogWrite(ledblue, LOW);
  443. analogWrite(ledgreen, LOW);
  444. tone(A0, 131, 375);
  445. delay(400);
  446.  
  447. //DS3
  448. analogWrite(ledblue, 255);
  449. tone(A0, 156, 175);
  450. delay(200);
  451.  
  452. //F3
  453. analogWrite(ledred, 255);
  454. tone(A0, 175, 175);
  455. delay(200);
  456.  
  457. //G3
  458. analogWrite(ledgreen, 255);
  459. tone(A0, 196, 375);
  460. delay(400);
  461.  
  462. ///////////////////////////////
  463.  
  464. //C3
  465. analogWrite(ledred, LOW);
  466. analogWrite(ledblue, LOW);
  467. analogWrite(ledgreen, LOW);
  468. tone(A0, 131, 375);
  469. delay(400);
  470.  
  471. //DS3
  472. analogWrite(ledblue, 255);
  473. tone(A0, 156, 175);
  474. delay(200);
  475.  
  476. //F3
  477. analogWrite(ledred, 255);
  478. tone(A0, 175, 175);
  479. delay(200);
  480.  
  481. //G3
  482. analogWrite(ledgreen, 255);
  483. tone(A0, 196, 375);
  484. delay(400);
  485.  
  486.  
  487. /////////////////////////////
  488.  
  489. //C3
  490. analogWrite(ledred, LOW);
  491. analogWrite(ledblue, LOW);
  492. analogWrite(ledgreen, LOW);
  493. tone(A0, 131, 375);
  494. delay(400);
  495.  
  496. //DS3
  497. analogWrite(ledblue, 255);
  498. tone(A0, 156, 175);
  499. delay(200);
  500.  
  501. //F3
  502. analogWrite(ledred, 255);
  503. tone(A0, 175, 175);
  504. delay(200);
  505.  
  506. //G3
  507. analogWrite(ledgreen, 255);
  508. tone(A0, 196, 375);
  509. delay(400);
  510.  
  511. /////////////////////////////
  512.  
  513. //C3
  514. analogWrite(ledred, LOW);
  515. analogWrite(ledblue, LOW);
  516. analogWrite(ledgreen, LOW);
  517. tone(A0, 131, 375);
  518. delay(400);
  519.  
  520. //DS3
  521. analogWrite(ledblue, 255);
  522. tone(A0, 156, 175);
  523. delay(200);
  524.  
  525. //F3
  526. analogWrite(ledred, 255);
  527. tone(A0, 175, 175);
  528. delay(200);
  529.  
  530. //G3
  531. analogWrite(ledgreen, 255);
  532. tone(A0, 196, 375);
  533. delay(400);
  534.  
  535. /////////////////////////////////////////////////CHORUS2////////////////////////////////////////////
  536.  
  537.  
  538. //G5
  539. analogWrite(ledred, 255);
  540. tone(A0, 392, 1175);
  541. delay(1200);
  542. analogWrite(ledred, LOW);
  543.  
  544. //C4
  545. analogWrite(ledblue, 255);
  546. tone(A0, 262, 1175);
  547. delay(1200);
  548. analogWrite(ledblue, LOW);
  549.  
  550. //DS4
  551. analogWrite(ledred, 255);
  552. tone(A0, 311, 175);
  553. delay(200);
  554.  
  555. //F4
  556. analogWrite(ledblue, 255);
  557. tone(A0, 349, 175);
  558. delay(200);
  559.  
  560. //G4
  561. analogWrite(ledgreen, 255);
  562. tone(A0, 392, 775);
  563. delay(800);
  564.  
  565. //C4
  566. analogWrite(ledred, LOW);
  567. analogWrite(ledgreen, LOW);
  568. analogWrite(ledblue, LOW);
  569. tone(A0, 262, 775);
  570. delay(800);
  571.  
  572. //DS4
  573. analogWrite(ledred, 255);
  574. tone(A0, 311, 175);
  575. delay(200);
  576.  
  577. //F4
  578. analogWrite(ledblue, 255);
  579. tone(A0, 349, 175);
  580. delay(200);
  581.  
  582. //////////////////////////////
  583.  
  584. //C3
  585. analogWrite(ledred, LOW);
  586. analogWrite(ledblue, LOW);
  587. analogWrite(ledgreen, LOW);
  588. tone(A0, 131, 375);
  589. delay(400);
  590.  
  591. //DS3
  592. analogWrite(ledblue, 255);
  593. tone(A0, 156, 175);
  594. delay(200);
  595.  
  596. //F3
  597. analogWrite(ledred, 255);
  598. tone(A0, 175, 175);
  599. delay(200);
  600.  
  601. //G3
  602. analogWrite(ledgreen, 255);
  603. tone(A0, 196, 375);
  604. delay(400);
  605.  
  606. ///////////////////////////////
  607.  
  608. //C3
  609. analogWrite(ledred, LOW);
  610. analogWrite(ledblue, LOW);
  611. analogWrite(ledgreen, LOW);
  612. tone(A0, 131, 375);
  613. delay(400);
  614.  
  615. //DS3
  616. analogWrite(ledblue, 255);
  617. tone(A0, 156, 175);
  618. delay(200);
  619.  
  620. //F3
  621. analogWrite(ledred, 255);
  622. tone(A0, 175, 175);
  623. delay(200);
  624.  
  625. //G3
  626. analogWrite(ledgreen, 255);
  627. tone(A0, 196, 375);
  628. delay(400);
  629.  
  630.  
  631.  
  632. /////////////////////////////
  633.  
  634. //C3
  635. analogWrite(ledred, LOW);
  636. analogWrite(ledblue, LOW);
  637. analogWrite(ledgreen, LOW);
  638. tone(A0, 131, 375);
  639. delay(400);
  640.  
  641. //DS3
  642. analogWrite(ledblue, 255);
  643. tone(A0, 156, 175);
  644. delay(200);
  645.  
  646. //F3
  647. analogWrite(ledred, 255);
  648. tone(A0, 175, 175);
  649. delay(200);
  650.  
  651. //G3
  652. analogWrite(ledgreen, 255);
  653. tone(A0, 196, 375);
  654. delay(400);
  655.  
  656. /////////////////////////////
  657.  
  658. //C3
  659. analogWrite(ledred, LOW);
  660. analogWrite(ledblue, LOW);
  661. analogWrite(ledgreen, LOW);
  662. tone(A0, 131, 375);
  663. delay(400);
  664.  
  665. //DS3
  666. analogWrite(ledblue, 255);
  667. tone(A0, 156, 175);
  668. delay(200);
  669.  
  670. //F3
  671. analogWrite(ledred, 255);
  672. tone(A0, 175, 175);
  673. delay(200);
  674.  
  675. //G3
  676. analogWrite(ledgreen, 255);
  677. tone(A0, 196, 375);
  678. delay(400);
  679. while(brightness > 0)
  680. {
  681. analogWrite(ledred, brightness);
  682. analogWrite(ledblue, brightness);
  683. analogWrite(ledgreen, brightness);
  684. brightness = brightness - fadeAmount;
  685. if (brightness == 0 || brightness == 255) {
  686. fadeAmount = -fadeAmount ;
  687. }
  688. }
  689. analogWrite(ledred, LOW);
  690. analogWrite(ledgreen, LOW);
  691. analogWrite(ledblue, LOW);
  692. brightness = 255;
  693. fadeAmount = 5;
  694.  
  695. //////////////////////////////////////////
  696.  
  697. //F4
  698. analogWrite(ledred, 255);
  699. tone(A0, 349, 1175);
  700. delay(1200);
  701. analogWrite(ledred, LOW);
  702.  
  703. //AS4
  704. analogWrite(ledblue, 255);
  705. tone(A0, 233, 1175);
  706. delay(1200);
  707. analogWrite(ledblue, LOW);
  708.  
  709. //D4
  710. analogWrite(ledred, 255);
  711. tone(A0, 294, 175);
  712. delay(200);
  713.  
  714. //DS4
  715. analogWrite(ledblue, 255);
  716. tone(A0, 311, 175);
  717. delay(200);
  718.  
  719. //F4
  720. analogWrite(ledgreen, 255);
  721. tone(A0, 349, 775);
  722. delay(800);
  723.  
  724. //AS3
  725. analogWrite(ledred, LOW);
  726. analogWrite(ledgreen, LOW);
  727. analogWrite(ledblue, LOW);
  728. tone(A0, 233, 775);
  729. delay(800);
  730.  
  731. //DS4
  732. analogWrite(ledred, 255);
  733. tone(A0, 311, 175);
  734. delay(200);
  735.  
  736. //D4
  737. analogWrite(ledblue, 255);
  738. tone(A0, 294, 175);
  739. delay(200);
  740.  
  741. //////////////////////////////
  742.  
  743. //C3
  744. analogWrite(ledred, LOW);
  745. analogWrite(ledblue, LOW);
  746. analogWrite(ledgreen, LOW);
  747. tone(A0, 131, 375);
  748. delay(400);
  749.  
  750. //DS3
  751. analogWrite(ledblue, 255);
  752. tone(A0, 156, 175);
  753. delay(200);
  754.  
  755. //F3
  756. analogWrite(ledred, 255);
  757. tone(A0, 175, 175);
  758. delay(200);
  759.  
  760. //G3
  761. analogWrite(ledgreen, 255);
  762. tone(A0, 196, 375);
  763. delay(400);
  764.  
  765. ///////////////////////////////
  766.  
  767. //C3
  768. analogWrite(ledred, LOW);
  769. analogWrite(ledblue, LOW);
  770. analogWrite(ledgreen, LOW);
  771. tone(A0, 131, 375);
  772. delay(400);
  773.  
  774. //DS3
  775. analogWrite(ledblue, 255);
  776. tone(A0, 156, 175);
  777. delay(200);
  778.  
  779. //F3
  780. analogWrite(ledred, 255);
  781. tone(A0, 175, 175);
  782. delay(200);
  783.  
  784. //G3
  785. analogWrite(ledgreen, 255);
  786. tone(A0, 196, 375);
  787. delay(400);
  788.  
  789.  
  790. /////////////////////////////
  791.  
  792. //C3
  793. analogWrite(ledred, LOW);
  794. analogWrite(ledblue, LOW);
  795. analogWrite(ledgreen, LOW);
  796. tone(A0, 131, 375);
  797. delay(400);
  798.  
  799. //DS3
  800. analogWrite(ledblue, 255);
  801. tone(A0, 156, 175);
  802. delay(200);
  803.  
  804. //F3
  805. analogWrite(ledred, 255);
  806. tone(A0, 175, 175);
  807. delay(200);
  808.  
  809. //G3
  810. analogWrite(ledgreen, 255);
  811. tone(A0, 196, 375);
  812. delay(400);
  813.  
  814. /////////////////////////////
  815.  
  816. //C3
  817. analogWrite(ledred, LOW);
  818. analogWrite(ledblue, LOW);
  819. analogWrite(ledgreen, LOW);
  820. tone(A0, 131, 375);
  821. delay(400);
  822.  
  823. //DS3
  824. analogWrite(ledblue, 255);
  825. tone(A0, 156, 175);
  826. delay(200);
  827.  
  828. //F3
  829. analogWrite(ledred, 255);
  830. tone(A0, 175, 175);
  831. delay(200);
  832.  
  833. //G3
  834. analogWrite(ledgreen, 255);
  835. tone(A0, 196, 375);
  836. delay(400);
  837.  
  838. /////////////////////////////////////////////////CHORUS3////////////////////////////////////////////
  839.  
  840.  
  841. //G5
  842. analogWrite(ledred, 255);
  843. tone(A0, 784, 1175);
  844. delay(1200);
  845. analogWrite(ledred, LOW);
  846.  
  847. //C5
  848. analogWrite(ledblue, 255);
  849. tone(A0, 523, 1175);
  850. delay(1200);
  851. analogWrite(ledblue, LOW);
  852.  
  853. //DS5
  854. analogWrite(ledred, 255);
  855. tone(A0, 622, 175);
  856. delay(200);
  857.  
  858. //F5
  859. analogWrite(ledblue, 255);
  860. tone(A0, 698, 175);
  861. delay(200);
  862.  
  863. //G5
  864. analogWrite(ledgreen, 255);
  865. tone(A0, 784, 775);
  866. delay(800);
  867.  
  868. //C5
  869. analogWrite(ledred, LOW);
  870. analogWrite(ledgreen, LOW);
  871. analogWrite(ledblue, LOW);
  872. tone(A0, 523, 775);
  873. delay(800);
  874.  
  875. //DS5
  876. analogWrite(ledred, 255);
  877. tone(A0, 622, 175);
  878. delay(200);
  879.  
  880. //F5
  881. analogWrite(ledblue, 255);
  882. tone(A0, 698, 175);
  883. delay(200);
  884.  
  885. //////////////////////////////
  886.  
  887. //C3
  888. analogWrite(ledred, LOW);
  889. analogWrite(ledblue, LOW);
  890. analogWrite(ledgreen, LOW);
  891. tone(A0, 131, 375);
  892. delay(400);
  893.  
  894. //DS3
  895. analogWrite(ledblue, 255);
  896. tone(A0, 156, 175);
  897. delay(200);
  898.  
  899. //F3
  900. analogWrite(ledred, 255);
  901. tone(A0, 175, 175);
  902. delay(200);
  903.  
  904. //G3
  905. analogWrite(ledgreen, 255);
  906. tone(A0, 196, 375);
  907. delay(400);
  908.  
  909. ///////////////////////////////
  910.  
  911. //C3
  912. analogWrite(ledred, LOW);
  913. analogWrite(ledblue, LOW);
  914. analogWrite(ledgreen, LOW);
  915. tone(A0, 131, 375);
  916. delay(400);
  917.  
  918. //DS3
  919. analogWrite(ledblue, 255);
  920. tone(A0, 156, 175);
  921. delay(200);
  922.  
  923. //F3
  924. analogWrite(ledred, 255);
  925. tone(A0, 175, 175);
  926. delay(200);
  927.  
  928. //G3
  929. analogWrite(ledgreen, 255);
  930. tone(A0, 196, 375);
  931. delay(400);
  932.  
  933.  
  934.  
  935. /////////////////////////////
  936.  
  937. //C3
  938. analogWrite(ledred, LOW);
  939. analogWrite(ledblue, LOW);
  940. analogWrite(ledgreen, LOW);
  941. tone(A0, 131, 375);
  942. delay(400);
  943.  
  944. //DS3
  945. analogWrite(ledblue, 255);
  946. tone(A0, 156, 175);
  947. delay(200);
  948.  
  949. //F3
  950. analogWrite(ledred, 255);
  951. tone(A0, 175, 175);
  952. delay(200);
  953.  
  954. //G3
  955. analogWrite(ledgreen, 255);
  956. tone(A0, 196, 375);
  957. delay(400);
  958.  
  959. /////////////////////////////
  960.  
  961. //C3
  962. analogWrite(ledred, LOW);
  963. analogWrite(ledblue, LOW);
  964. analogWrite(ledgreen, LOW);
  965. tone(A0, 131, 375);
  966. delay(400);
  967.  
  968. //DS3
  969. analogWrite(ledblue, 255);
  970. tone(A0, 156, 175);
  971. delay(200);
  972.  
  973. //F3
  974. analogWrite(ledred, 255);
  975. tone(A0, 175, 175);
  976. delay(200);
  977.  
  978. //G3
  979. analogWrite(ledgreen, 255);
  980. tone(A0, 196, 375);
  981. delay(400);
  982. while(brightness > 0)
  983. {
  984. analogWrite(ledred, brightness);
  985. analogWrite(ledblue, brightness);
  986. analogWrite(ledgreen, brightness);
  987. brightness = brightness - fadeAmount;
  988. if (brightness == 0 || brightness == 255) {
  989. fadeAmount = -fadeAmount ;
  990. }
  991. }
  992. analogWrite(ledred, LOW);
  993. analogWrite(ledgreen, LOW);
  994. analogWrite(ledblue, LOW);
  995. brightness = 255;
  996. fadeAmount = 5;
  997.  
  998.  
  999. ////////////////////////////////
  1000.  
  1001.  
  1002. //F5
  1003. analogWrite(ledred, 255);
  1004. tone(A0, 698, 1175);
  1005. delay(1200);
  1006. analogWrite(ledred, LOW);
  1007.  
  1008. //AS4
  1009. analogWrite(ledblue, 255);
  1010. tone(A0, 466, 1175);
  1011. delay(1200);
  1012. analogWrite(ledblue, LOW);
  1013.  
  1014. //D5
  1015. analogWrite(ledred, 255);
  1016. tone(A0, 587, 575);
  1017. delay(600);
  1018.  
  1019. //DS5
  1020. analogWrite(ledblue, 255);
  1021. tone(A0, 622, 575);
  1022. delay(600);
  1023.  
  1024. //D5
  1025. analogWrite(ledgreen, 255);
  1026. tone(A0, 587, 575);
  1027. delay(600);
  1028.  
  1029. //AS4
  1030. tone(A0, 466, 575);
  1031. delay(600);
  1032.  
  1033. ///////////////////////////////
  1034.  
  1035. //C3
  1036. analogWrite(ledred, LOW);
  1037. analogWrite(ledblue, LOW);
  1038. analogWrite(ledgreen, LOW);
  1039. tone(A0, 131, 375);
  1040. delay(400);
  1041.  
  1042. //DS3
  1043. analogWrite(ledblue, 255);
  1044. tone(A0, 156, 175);
  1045. delay(200);
  1046.  
  1047. //F3
  1048. analogWrite(ledred, 255);
  1049. tone(A0, 175, 175);
  1050. delay(200);
  1051.  
  1052. //G3
  1053. analogWrite(ledgreen, 255);
  1054. tone(A0, 196, 375);
  1055. delay(400);
  1056.  
  1057. ///////////////////////////////
  1058.  
  1059. //C3
  1060. analogWrite(ledred, LOW);
  1061. analogWrite(ledblue, LOW);
  1062. analogWrite(ledgreen, LOW);
  1063. tone(A0, 131, 375);
  1064. delay(400);
  1065.  
  1066. //DS3
  1067. analogWrite(ledblue, 255);
  1068. tone(A0, 156, 175);
  1069. delay(200);
  1070.  
  1071. //F3
  1072. analogWrite(ledred, 255);
  1073. tone(A0, 175, 175);
  1074. delay(200);
  1075.  
  1076. //G3
  1077. analogWrite(ledgreen, 255);
  1078. tone(A0, 196, 375);
  1079. delay(400);
  1080.  
  1081.  
  1082. /////////////////////////////
  1083.  
  1084. //C3
  1085. analogWrite(ledred, LOW);
  1086. analogWrite(ledblue, LOW);
  1087. analogWrite(ledgreen, LOW);
  1088. tone(A0, 131, 375);
  1089. delay(400);
  1090.  
  1091. //DS3
  1092. analogWrite(ledblue, 255);
  1093. tone(A0, 156, 175);
  1094. delay(200);
  1095.  
  1096. //F3
  1097. analogWrite(ledred, 255);
  1098. tone(A0, 175, 175);
  1099. delay(200);
  1100.  
  1101. //G3
  1102. analogWrite(ledgreen, 255);
  1103. tone(A0, 196, 375);
  1104. delay(400);
  1105.  
  1106. /////////////////////////////
  1107.  
  1108. //C3
  1109. analogWrite(ledred, LOW);
  1110. analogWrite(ledblue, LOW);
  1111. analogWrite(ledgreen, LOW);
  1112. tone(A0, 131, 375);
  1113. delay(400);
  1114.  
  1115. //DS3
  1116. analogWrite(ledblue, 255);
  1117. tone(A0, 156, 175);
  1118. delay(200);
  1119.  
  1120. //F3
  1121. analogWrite(ledred, 255);
  1122. tone(A0, 175, 175);
  1123. delay(200);
  1124.  
  1125. //G3
  1126. analogWrite(ledgreen, 255);
  1127. tone(A0, 196, 375);
  1128. delay(400);
  1129. while(brightness > 0)
  1130. {
  1131. analogWrite(ledred, brightness);
  1132. analogWrite(ledblue, brightness);
  1133. analogWrite(ledgreen, brightness);
  1134. brightness = brightness - fadeAmount;
  1135. if (brightness == 0 || brightness == 255) {
  1136. fadeAmount = -fadeAmount ;
  1137. }
  1138. }
  1139. analogWrite(ledred, LOW);
  1140. analogWrite(ledgreen, LOW);
  1141. analogWrite(ledblue, LOW);
  1142. brightness = 255;
  1143. fadeAmount = 5;
  1144.  
  1145.  
  1146.  
  1147. //////////////////////////////////////////////////////////////////////////////////////////
  1148.  
  1149. //C5
  1150. analogWrite(ledred, LOW);
  1151. analogWrite(ledgreen, LOW);
  1152. analogWrite(ledblue, LOW);
  1153. tone(A0, 523, 375);
  1154. delay(400);
  1155.  
  1156.  
  1157. //DS3
  1158. analogWrite(ledblue, 255);
  1159. tone(A0, 156, 175);
  1160. delay(200);
  1161.  
  1162. //F3
  1163. analogWrite(ledred, 255);
  1164. tone(A0, 175, 175);
  1165. delay(200);
  1166.  
  1167. //G3
  1168. analogWrite(ledgreen, 255);
  1169. tone(A0, 196, 375);
  1170. delay(400);
  1171.  
  1172. ///////////
  1173.  
  1174. //C5
  1175. analogWrite(ledred, LOW);
  1176. analogWrite(ledgreen, LOW);
  1177. analogWrite(ledblue, LOW);
  1178. tone(A0, 523, 375);
  1179. delay(400);
  1180.  
  1181. //DS3
  1182. analogWrite(ledblue, 255);
  1183. tone(A0, 156, 175);
  1184. delay(200);
  1185.  
  1186. //F3
  1187. analogWrite(ledred, 255);
  1188. tone(A0, 175, 175);
  1189. delay(200);
  1190.  
  1191. //G3
  1192. analogWrite(ledgreen, 255);
  1193. tone(A0, 196, 375);
  1194. delay(400);
  1195.  
  1196.  
  1197. ///////////////////////////////////////////
  1198.  
  1199. //AS4
  1200. analogWrite(ledred, LOW);
  1201. analogWrite(ledgreen, LOW);
  1202. analogWrite(ledblue, LOW);
  1203. tone(A0, 466, 375);
  1204. delay(400);
  1205.  
  1206. //D3
  1207. analogWrite(ledred, 255);
  1208. tone(A0, 147, 175);
  1209. delay(200);
  1210.  
  1211. //DS3
  1212. analogWrite(ledblue, 255);
  1213. tone(A0, 156, 175);
  1214. delay(200);
  1215.  
  1216. //F3
  1217. analogWrite(ledgreen, 255);
  1218. tone(A0, 175, 375);
  1219. delay(400);
  1220.  
  1221. /////////
  1222.  
  1223. //AS4
  1224. analogWrite(ledred, LOW);
  1225. analogWrite(ledgreen, LOW);
  1226. analogWrite(ledblue, LOW);
  1227. tone(A0, 466, 375);
  1228. delay(400);
  1229.  
  1230. //D3
  1231. analogWrite(ledred, 255);
  1232. tone(A0, 147, 175);
  1233. delay(200);
  1234.  
  1235. //DS3
  1236. analogWrite(ledblue, 255);
  1237. tone(A0, 156, 175);
  1238. delay(200);
  1239.  
  1240. //F3
  1241. analogWrite(ledgreen, 255);
  1242. tone(A0, 175, 375);
  1243. delay(400);
  1244.  
  1245.  
  1246. //////////////////////////////////////////
  1247.  
  1248. //GS4
  1249. analogWrite(ledred, LOW);
  1250. analogWrite(ledgreen, LOW);
  1251. analogWrite(ledblue, LOW);
  1252. tone(A0, 415, 375);
  1253. delay(400);
  1254.  
  1255. //C3
  1256. analogWrite(ledred, 255);
  1257. tone(A0, 131, 175);
  1258. delay(200);
  1259.  
  1260. //D3
  1261. analogWrite(ledblue, 255);
  1262. tone(A0, 147, 175);
  1263. delay(200);
  1264.  
  1265. //DS3
  1266. analogWrite(ledgreen, 255);
  1267. tone(A0, 156, 375);
  1268. delay(400);
  1269.  
  1270. //////////
  1271.  
  1272. //GS4
  1273. analogWrite(ledred, LOW);
  1274. analogWrite(ledgreen, LOW);
  1275. analogWrite(ledblue, LOW);
  1276. tone(A0, 415, 375);
  1277. delay(400);
  1278.  
  1279. //C3
  1280. analogWrite(ledred, 255);
  1281. tone(A0, 131, 175);
  1282. delay(200);
  1283.  
  1284. //D3
  1285. analogWrite(ledblue, 255);
  1286. tone(A0, 147, 175);
  1287. delay(200);
  1288.  
  1289. //DS3
  1290. analogWrite(ledgreen, 255);
  1291. tone(A0, 156, 375);
  1292. delay(400);
  1293.  
  1294.  
  1295. /////////////////////////////////////////
  1296.  
  1297. //G4
  1298. analogWrite(ledred, LOW);
  1299. analogWrite(ledgreen, LOW);
  1300. analogWrite(ledblue, LOW);
  1301. tone(A0, 392, 375);
  1302. delay(400);
  1303.  
  1304. //AS2
  1305. analogWrite(ledred, 255);
  1306. tone(A0, 117, 175);
  1307. delay(200);
  1308.  
  1309. //C3
  1310. analogWrite(ledblue, 255);
  1311. tone(A0, 131, 175);
  1312. delay(200);
  1313.  
  1314. //D3
  1315. analogWrite(ledgreen, 255);
  1316. tone(A0, 147, 375);
  1317. delay(400);
  1318.  
  1319. ///////////
  1320.  
  1321. //G4
  1322. analogWrite(ledred, LOW);
  1323. analogWrite(ledgreen, LOW);
  1324. analogWrite(ledblue, LOW);
  1325. tone(A0, 392, 375);
  1326. delay(400);
  1327.  
  1328. //AS2
  1329. analogWrite(ledred, 255);
  1330. tone(A0, 117, 175);
  1331. delay(200);
  1332.  
  1333. //C3
  1334. analogWrite(ledblue, 255);
  1335. tone(A0, 131, 175);
  1336. delay(200);
  1337.  
  1338. //D3
  1339. analogWrite(ledgreen, 255);
  1340. tone(A0, 147, 375);
  1341. delay(400);
  1342.  
  1343.  
  1344. /////////////////////////////////////////
  1345.  
  1346. //DS4
  1347. analogWrite(ledred, LOW);
  1348. analogWrite(ledgreen, LOW);
  1349. analogWrite(ledblue, LOW);
  1350. tone(A0, 311, 375);
  1351. delay(400);
  1352.  
  1353. //G2
  1354. analogWrite(ledblue, 255);
  1355. tone(A0, 98, 175);
  1356. delay(200);
  1357.  
  1358. //GS2
  1359. analogWrite(ledgreen, 255);
  1360. tone(A0, 104, 175);
  1361. delay(200);
  1362.  
  1363. //AS2
  1364. analogWrite(ledred, 255);
  1365. tone(A0, 117, 375);
  1366. delay(400);
  1367.  
  1368. ///////////
  1369.  
  1370. //DS4
  1371. analogWrite(ledred, LOW);
  1372. analogWrite(ledgreen, LOW);
  1373. analogWrite(ledblue, LOW);
  1374. tone(A0, 311, 375);
  1375. delay(400);
  1376.  
  1377. //G2
  1378. analogWrite(ledblue, 255);
  1379. tone(A0, 98, 175);
  1380. delay(200);
  1381.  
  1382. //GS2
  1383. analogWrite(ledgreen, 255);
  1384. tone(A0, 104, 175);
  1385. delay(200);
  1386.  
  1387. //AS2
  1388. analogWrite(ledred, 255);
  1389. tone(A0, 117, 375);
  1390. delay(400);
  1391.  
  1392.  
  1393. //////////////////////////////////////////
  1394.  
  1395. //DS4
  1396. analogWrite(ledred, LOW);
  1397. analogWrite(ledgreen, LOW);
  1398. analogWrite(ledblue, LOW);
  1399. tone(A0, 311, 375);
  1400. delay(400);
  1401.  
  1402. //G2
  1403. analogWrite(ledblue, 255);
  1404. tone(A0, 98, 175);
  1405. delay(200);
  1406.  
  1407. //G2
  1408. analogWrite(ledred, 255);
  1409. tone(A0, 98, 175);
  1410. delay(200);
  1411.  
  1412. //DS4
  1413. analogWrite(ledgreen, 255);
  1414. tone(A0, 311, 375);
  1415. delay(400);
  1416.  
  1417. //F4
  1418. analogWrite(ledred, LOW);
  1419. analogWrite(ledgreen, LOW);
  1420. analogWrite(ledblue, LOW);
  1421. tone(A0, 349, 775);
  1422. delay(400);
  1423.  
  1424. //GS2
  1425. analogWrite(ledblue, 255);
  1426. tone(A0, 104, 175);
  1427. delay(200);
  1428.  
  1429. //GS2
  1430. analogWrite(ledgreen, 255);
  1431. tone(A0, 104, 175);
  1432. delay(200);
  1433.  
  1434. //F4
  1435. analogWrite(ledred, 255);
  1436. tone(A0, 349, 375);
  1437. delay(400);
  1438.  
  1439. //////////////////////////////////////////
  1440.  
  1441. //C4
  1442. analogWrite(ledred, LOW);
  1443. analogWrite(ledgreen, LOW);
  1444. analogWrite(ledblue, LOW);
  1445. tone(A0, 262, 375);
  1446. delay(400);
  1447.  
  1448. //DS3
  1449. analogWrite(ledblue, 255);
  1450. tone(A0, 156, 175);
  1451. delay(200);
  1452.  
  1453. //F3
  1454. analogWrite(ledred, 255);
  1455. tone(A0, 175, 175);
  1456. delay(200);
  1457.  
  1458. //G3
  1459. analogWrite(ledgreen, 255);
  1460. tone(A0, 196, 375);
  1461. delay(400);
  1462.  
  1463. ///////////
  1464.  
  1465. //C3
  1466. analogWrite(ledred, LOW);
  1467. analogWrite(ledgreen, LOW);
  1468. analogWrite(ledblue, LOW);
  1469. tone(A0, 131, 375);
  1470. delay(400);
  1471.  
  1472. //DS3
  1473. analogWrite(ledblue, 255);
  1474. tone(A0, 156, 175);
  1475. delay(200);
  1476.  
  1477. //F3
  1478. analogWrite(ledred, 255);
  1479. tone(A0, 175, 175);
  1480. delay(200);
  1481.  
  1482. //G3
  1483. analogWrite(ledgreen, 255);
  1484. tone(A0, 196, 375);
  1485. delay(400);
  1486.  
  1487. //C3
  1488. analogWrite(ledred, LOW);
  1489. analogWrite(ledgreen, LOW);
  1490. analogWrite(ledblue, LOW);
  1491. tone(A0, 131, 375);
  1492. delay(400);
  1493.  
  1494. //DS3
  1495. analogWrite(ledblue, 255);
  1496. tone(A0, 156, 175);
  1497. delay(200);
  1498.  
  1499. //F3
  1500. analogWrite(ledred, 255);
  1501. tone(A0, 175, 175);
  1502. delay(200);
  1503.  
  1504. //G3
  1505. analogWrite(ledgreen, 255);
  1506. tone(A0, 196, 375);
  1507. delay(400);
  1508.  
  1509. //C3
  1510. analogWrite(ledred, LOW);
  1511. analogWrite(ledgreen, LOW);
  1512. analogWrite(ledblue, LOW);
  1513. tone(A0, 131, 375);
  1514. delay(400);
  1515.  
  1516. //DS3
  1517. analogWrite(ledblue, 255);
  1518. tone(A0, 156, 175);
  1519. delay(200);
  1520.  
  1521. //F3
  1522. analogWrite(ledred, 255);
  1523. tone(A0, 175, 175);
  1524. delay(200);
  1525.  
  1526. //G3
  1527. analogWrite(ledgreen, 255);
  1528. tone(A0, 196, 375);
  1529. delay(400);
  1530.  
  1531. ////////////////////////////////////////////////////////////////////////////////////////
  1532. ////////////////////////////////////////////////////////////////////////////////////////
  1533.  
  1534. //C5
  1535. analogWrite(ledred, LOW);
  1536. analogWrite(ledgreen, LOW);
  1537. analogWrite(ledblue, LOW);
  1538. tone(A0, 523, 375);
  1539. delay(400);
  1540.  
  1541. //DS3
  1542. analogWrite(ledblue, 255);
  1543. tone(A0, 156, 175);
  1544. delay(200);
  1545.  
  1546. //F3
  1547. analogWrite(ledred, 255);
  1548. tone(A0, 175, 175);
  1549. delay(200);
  1550.  
  1551. //G3
  1552. analogWrite(ledgreen, 255);
  1553. tone(A0, 196, 375);
  1554. delay(400);
  1555.  
  1556. ///////////
  1557.  
  1558. //C5
  1559. analogWrite(ledred, LOW);
  1560. analogWrite(ledgreen, LOW);
  1561. analogWrite(ledblue, LOW);
  1562. analogWrite(ledblue, 255);
  1563. tone(A0, 523, 375);
  1564. delay(400);
  1565.  
  1566. //DS3
  1567. analogWrite(ledblue, 255);
  1568. tone(A0, 156, 175);
  1569. delay(200);
  1570.  
  1571. //F3
  1572. analogWrite(ledred, 255);
  1573. tone(A0, 175, 175);
  1574. delay(200);
  1575.  
  1576. //G3
  1577. analogWrite(ledgreen, 255);
  1578. tone(A0, 196, 375);
  1579. delay(400);
  1580.  
  1581.  
  1582. ///////////////////////////////////////////
  1583.  
  1584. //AS4
  1585. analogWrite(ledred, LOW);
  1586. analogWrite(ledgreen, LOW);
  1587. analogWrite(ledblue, LOW);
  1588. tone(A0, 466, 375);
  1589. delay(400);
  1590.  
  1591. //D3
  1592. analogWrite(ledred, 255);
  1593. tone(A0, 147, 175);
  1594. delay(200);
  1595.  
  1596. //DS3
  1597. analogWrite(ledblue, 255);
  1598. tone(A0, 156, 175);
  1599. delay(200);
  1600.  
  1601. //F3
  1602. analogWrite(ledgreen, 255);
  1603. tone(A0, 175, 375);
  1604. delay(400);
  1605.  
  1606. /////////
  1607.  
  1608. //AS4
  1609. analogWrite(ledred, LOW);
  1610. analogWrite(ledgreen, LOW);
  1611. analogWrite(ledblue, LOW);
  1612. tone(A0, 466, 375);
  1613. delay(400);
  1614.  
  1615. //D3
  1616. analogWrite(ledred, 255);
  1617. tone(A0, 147, 175);
  1618. delay(200);
  1619.  
  1620. //DS3
  1621. analogWrite(ledblue, 255);
  1622. tone(A0, 156, 175);
  1623. delay(200);
  1624.  
  1625. //F3
  1626. analogWrite(ledgreen, 255);
  1627. tone(A0, 175, 375);
  1628. delay(400);
  1629.  
  1630.  
  1631. //////////////////////////////////////////
  1632.  
  1633. //GS4
  1634. analogWrite(ledred, LOW);
  1635. analogWrite(ledgreen, LOW);
  1636. analogWrite(ledblue, LOW);
  1637. tone(A0, 415, 375);
  1638. delay(400);
  1639.  
  1640. //C3
  1641. analogWrite(ledred, 255);
  1642. tone(A0, 131, 175);
  1643. delay(200);
  1644.  
  1645. //D3
  1646. analogWrite(ledblue, 255);
  1647. tone(A0, 147, 175);
  1648. delay(200);
  1649.  
  1650. //DS3
  1651. analogWrite(ledgreen, 255);
  1652. tone(A0, 156, 375);
  1653. delay(400);
  1654.  
  1655. //////////
  1656.  
  1657. //GS4
  1658. analogWrite(ledred, LOW);
  1659. analogWrite(ledgreen, LOW);
  1660. analogWrite(ledblue, LOW);
  1661. tone(A0, 415, 375);
  1662. delay(400);
  1663.  
  1664. //C3
  1665. analogWrite(ledred, 255);
  1666. tone(A0, 131, 175);
  1667. delay(200);
  1668.  
  1669. //D3
  1670. analogWrite(ledblue, 255);
  1671. tone(A0, 147, 175);
  1672. delay(200);
  1673.  
  1674. //DS3
  1675. analogWrite(ledgreen, 255);
  1676. tone(A0, 156, 375);
  1677. delay(400);
  1678.  
  1679.  
  1680. /////////////////////////////////////////
  1681.  
  1682. //G4
  1683. analogWrite(ledred, LOW);
  1684. analogWrite(ledgreen, LOW);
  1685. analogWrite(ledblue, LOW);
  1686. tone(A0, 392, 375);
  1687. delay(400);
  1688.  
  1689. //AS2
  1690. analogWrite(ledred, 255);
  1691. tone(A0, 117, 175);
  1692. delay(200);
  1693.  
  1694. //C3
  1695. analogWrite(ledblue, 255);
  1696. tone(A0, 131, 175);
  1697. delay(200);
  1698.  
  1699. //D3
  1700. analogWrite(ledgreen, 255);
  1701. tone(A0, 147, 375);
  1702. delay(400);
  1703.  
  1704. ///////////
  1705.  
  1706. //G4
  1707. analogWrite(ledred, LOW);
  1708. analogWrite(ledgreen, LOW);
  1709. analogWrite(ledblue, LOW);
  1710. tone(A0, 392, 375);
  1711. delay(400);
  1712.  
  1713. //AS2
  1714. analogWrite(ledred, 255);
  1715. tone(A0, 117, 175);
  1716. delay(200);
  1717.  
  1718. //C3
  1719. analogWrite(ledblue, 255);
  1720. tone(A0, 131, 175);
  1721. delay(200);
  1722.  
  1723. //D3
  1724. analogWrite(ledgreen, 255);
  1725. tone(A0, 147, 375);
  1726. delay(400);
  1727.  
  1728.  
  1729. /////////////////////////////////////////
  1730.  
  1731. //DS4
  1732. analogWrite(ledred, LOW);
  1733. analogWrite(ledgreen, LOW);
  1734. analogWrite(ledblue, LOW);
  1735. tone(A0, 311, 375);
  1736. delay(400);
  1737.  
  1738. //G2
  1739. analogWrite(ledred, 255);
  1740. tone(A0, 98, 175);
  1741. delay(200);
  1742.  
  1743. //GS2
  1744. analogWrite(ledblue, 255);
  1745. tone(A0, 104, 175);
  1746. delay(200);
  1747.  
  1748. //AS2
  1749. analogWrite(ledgreen, 255);
  1750. tone(A0, 117, 375);
  1751. delay(400);
  1752.  
  1753. ///////////
  1754.  
  1755. //DS4
  1756. analogWrite(ledred, LOW);
  1757. analogWrite(ledgreen, LOW);
  1758. analogWrite(ledblue, LOW);
  1759. tone(A0, 311, 375);
  1760. delay(400);
  1761.  
  1762. //G2
  1763. analogWrite(ledred, 255);
  1764. tone(A0, 98, 175);
  1765. delay(200);
  1766.  
  1767. //GS2
  1768. analogWrite(ledblue, 255);
  1769. tone(A0, 104, 175);
  1770. delay(200);
  1771.  
  1772. //AS2
  1773. analogWrite(ledgreen, 255);
  1774. tone(A0, 117, 375);
  1775. delay(400);
  1776.  
  1777.  
  1778. //////////////////////////////////////////
  1779.  
  1780. //DS4
  1781. analogWrite(ledred, LOW);
  1782. analogWrite(ledgreen, LOW);
  1783. analogWrite(ledblue, LOW);
  1784. tone(A0, 311, 775);
  1785. delay(800);
  1786.  
  1787. //DS4
  1788. analogWrite(ledred, 255);
  1789. tone(A0, 311, 375);
  1790. delay(400);
  1791.  
  1792. //D4
  1793. analogWrite(ledred, LOW);
  1794. tone(A0, 294, 775);
  1795. delay(800);
  1796.  
  1797. //D4
  1798. analogWrite(ledblue, 255);
  1799. tone(A0, 294, 375);
  1800. delay(400);
  1801.  
  1802. //////////////////////////////////////////
  1803.  
  1804. //C4
  1805. analogWrite(ledred, LOW);
  1806. analogWrite(ledgreen, LOW);
  1807. analogWrite(ledblue, LOW);
  1808. tone(A0, 262, 375);
  1809. delay(400);
  1810.  
  1811. //DS3
  1812. analogWrite(ledblue, 255);
  1813. tone(A0, 156, 175);
  1814. delay(200);
  1815.  
  1816. //F3
  1817. analogWrite(ledred, 255);
  1818. tone(A0, 175, 175);
  1819. delay(200);
  1820.  
  1821. //G3
  1822. analogWrite(ledgreen, 255);
  1823. tone(A0, 196, 375);
  1824. delay(400);
  1825.  
  1826. ///////////
  1827.  
  1828. //C3
  1829. analogWrite(ledred, LOW);
  1830. analogWrite(ledgreen, LOW);
  1831. analogWrite(ledblue, LOW);
  1832. tone(A0, 131, 375);
  1833. delay(400);
  1834.  
  1835. //DS3
  1836. analogWrite(ledblue, 255);
  1837. tone(A0, 156, 175);
  1838. delay(200);
  1839.  
  1840. //F3
  1841. analogWrite(ledred, 255);
  1842. tone(A0, 175, 175);
  1843. delay(200);
  1844.  
  1845. //G3
  1846. analogWrite(ledgreen, 255);
  1847. tone(A0, 196, 375);
  1848. delay(400);
  1849.  
  1850. /////////////
  1851.  
  1852. //C3
  1853. analogWrite(ledred, LOW);
  1854. analogWrite(ledgreen, LOW);
  1855. analogWrite(ledblue, LOW);
  1856. tone(A0, 131, 375);
  1857. delay(400);
  1858.  
  1859. //DS3
  1860. analogWrite(ledblue, 255);
  1861. tone(A0, 156, 175);
  1862. delay(200);
  1863.  
  1864. //F3
  1865. analogWrite(ledred, 255);
  1866. tone(A0, 175, 175);
  1867. delay(200);
  1868.  
  1869. //G3
  1870. analogWrite(ledgreen, 255);
  1871. tone(A0, 196, 375);
  1872. delay(400);
  1873.  
  1874. ////////////
  1875.  
  1876. //C3
  1877. analogWrite(ledred, LOW);
  1878. analogWrite(ledgreen, LOW);
  1879. analogWrite(ledblue, LOW);
  1880. tone(A0, 131, 375);
  1881. delay(400);
  1882.  
  1883. //DS3
  1884. analogWrite(ledblue, 255);
  1885. tone(A0, 156, 175);
  1886. delay(200);
  1887.  
  1888. //F3
  1889. analogWrite(ledred, 255);
  1890. tone(A0, 175, 175);
  1891. delay(200);
  1892.  
  1893. //G3
  1894. analogWrite(ledgreen, 255);
  1895. tone(A0, 196, 375);
  1896. delay(400);
  1897.  
  1898. ///////////////
  1899.  
  1900. //C3
  1901. analogWrite(ledred, LOW);
  1902. analogWrite(ledgreen, LOW);
  1903. analogWrite(ledblue, LOW);
  1904. tone(A0, 131, 375);
  1905. delay(400);
  1906.  
  1907. //DS3
  1908. analogWrite(ledblue, 255);
  1909. tone(A0, 156, 175);
  1910. delay(200);
  1911.  
  1912. //F3
  1913. analogWrite(ledred, 255);
  1914. tone(A0, 175, 175);
  1915. delay(200);
  1916.  
  1917. //G3
  1918. analogWrite(ledgreen, 255);
  1919. tone(A0, 196, 375);
  1920. delay(400);
  1921.  
  1922. ////////////////////////////////////////////////
  1923.  
  1924. //C3
  1925. analogWrite(ledred, LOW);
  1926. analogWrite(ledgreen, LOW);
  1927. analogWrite(ledblue, LOW);
  1928. tone(A0, 131, 375);
  1929. delay(400);
  1930.  
  1931. //DS5
  1932. analogWrite(ledblue, 255);
  1933. tone(A0, 622, 175);
  1934. delay(200);
  1935.  
  1936. //F5
  1937. analogWrite(ledred, 255);
  1938. tone(A0, 698, 175);
  1939. delay(200);
  1940.  
  1941. //G5
  1942. analogWrite(ledgreen, 255);
  1943. tone(A0, 784, 375);
  1944. delay(400);
  1945.  
  1946. /////////////////////////////////////////////////
  1947.  
  1948. //C5
  1949. analogWrite(ledgreen, 255);
  1950. tone(A0, 523, 375);
  1951. delay(400);
  1952.  
  1953. //DS5
  1954. analogWrite(ledred, LOW);
  1955. tone(A0, 622, 175);
  1956. delay(200);
  1957.  
  1958. //F5
  1959. analogWrite(ledgreen, LOW);
  1960. tone(A0, 698, 175);
  1961. delay(200);
  1962.  
  1963. //G5
  1964. analogWrite(ledblue, LOW);
  1965. tone(A0, 784, 375);
  1966. delay(400);
  1967.  
  1968. /////////////////////////////////////////////////
  1969.  
  1970. //C5
  1971. analogWrite(ledgreen, 255);
  1972. tone(A0, 523, 375);
  1973. delay(400);
  1974.  
  1975. //DS5
  1976. analogWrite(ledblue, 255);
  1977. tone(A0, 622, 175);
  1978. delay(200);
  1979.  
  1980. //F5
  1981. analogWrite(ledred, 255);
  1982. tone(A0, 698, 175);
  1983. delay(200);
  1984.  
  1985. //G5
  1986. analogWrite(ledgreen, 255);
  1987. tone(A0, 784, 375);
  1988. delay(400);
  1989. while(brightness > 0)
  1990. {
  1991. analogWrite(ledred, brightness);
  1992. analogWrite(ledblue, brightness);
  1993. analogWrite(ledgreen, brightness);
  1994. brightness = brightness - fadeAmount;
  1995. if (brightness == 0 || brightness == 255) {
  1996. fadeAmount = -fadeAmount ;
  1997. }
  1998. }
  1999. analogWrite(ledred, LOW);
  2000. analogWrite(ledgreen, LOW);
  2001. analogWrite(ledblue, LOW);
  2002. brightness = 255;
  2003. fadeAmount = 5;
  2004.  
  2005. delay(3000);
  2006.  
  2007. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement