daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Mar 14th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int red = 9, green = 10, blue = 11;
  2.  
  3. void setup() {
  4.   // put your setup code here, to run once:
  5.   pinMode(red, OUTPUT);
  6.   pinMode(green, OUTPUT);
  7.   pinMode(blue, OUTPUT);
  8.  
  9.   analogWrite(red, 255);
  10.   analogWrite(green, 255);
  11.   analogWrite(blue, 255);
  12. }
  13.  
  14. void loop() {
  15.   for(int o=0; o<100; o++){
  16.     b3();
  17.   }
  18.  
  19.   b1();
  20.  
  21.   for(int o=0; o<75; o++){
  22.     b2();
  23.   }
  24.  
  25. }
  26.  
  27.  
  28. // - - - - - - -- - -
  29. void b3(){
  30.   for(int i=0; i<255; i+=15){
  31.     onRed(i);
  32.     offGre(i);
  33.     d(50);
  34.   }
  35.  
  36.   for(int i=0; i<255; i+=15){
  37.     onBlu(i);
  38.     offRed(i);
  39.     d(50);
  40.   }
  41.  
  42.   for(int i=0; i<255; i+=15){
  43.     onGre(i);
  44.     offBlu(i);
  45.     d(50);
  46.   }
  47.  
  48. }
  49.  
  50. // - - - - - - -- - -
  51. void b2(){
  52.   for(int i=0; i<255; i+=5){
  53.     onRed(i);
  54.     offGre(i);
  55.     d(50);
  56.   }
  57.  
  58.   for(int i=0; i<255; i+=5){
  59.     onBlu(i);
  60.     offRed(i);
  61.     d(50);
  62.   }
  63.  
  64.   for(int i=0; i<255; i+=5){
  65.     onGre(i);
  66.     offBlu(i);
  67.     d(50);
  68.   }
  69.  
  70. }
  71.  
  72. // - - - - - - -- - -
  73. void b1(){
  74.   for(int i=0; i<20; i++){
  75.     onRed(255);d(500);offRed(255);
  76.     onGre(255);d(500);offGre(255);
  77.     onBlu(255);d(500);offBlu(255);
  78.   }
  79. }
  80.  
  81.  
  82.  
  83. void d(int i){
  84.   delay(i);
  85. }
  86.  
  87. void onRed(int i){
  88.   analogWrite(red, 255-i);
  89. }
  90. void offRed(int i){
  91.   analogWrite(red, i);
  92. }
  93. void onBlu(int i){
  94.   analogWrite(blue, 255-i);
  95. }
  96. void offBlu(int i){
  97.   analogWrite(blue, i);
  98. }
  99. void onGre(int i){
  100.   analogWrite(green, 255-i);
  101. }
  102. void offGre(int i){
  103.   analogWrite(green, i);
  104. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top