Nofew icon

Untitled

Nofew | PRO | 06/17/12 05:52:51 PM UTC | 0 ⭐ | 326 👁️ | Never ⏰ | []
C |

1.34 KB

|

None

|

0 👍

/

0 👎

#include <Metro.h>
 
const int pins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10};
 
void setup() {
  Serial.begin(9600);
  int i;
  Serial.println(i);
  for(i=0;i<9;i++) {
    pinMode(pins[i], OUTPUT);
    //Serial.println(i);
  }
  for(i=0;i<3;i++) {
    digitalWrite(pins[i], LOW);
    //Serial.println(i);
  }
  for(i=3;i<9;i++) {
    digitalWrite(pins[i], HIGH);
    //Serial.println(i);
  }
  randomSeed(7);
}
 
void loop() {
  int rn = 0;
  analogWrite(pins[5], 247);
  analogWrite(pins[8], 247);
  analogWrite(pins[1], 11);
  Metro col1 = Metro(80);
  Metro col2 = Metro(100);
  Metro col3 = Metro(120);
  Metro change = Metro(100);
  const short int DIFF = 65;
  /* The idea is that we set the default for "flame orange"
  right here first, then the code below slowly changes it.
  Somehow.
 
  ...Wait. How do I ever, what is this...*/
  short int b = 190+DIFF;
  short int a = 190-DIFF;
  short int d = 0;
  short int c = 0;
  short int f = 0;
  short int e = 0;
 
  while(1) {
    if (change.check() == 1) {
      b--;
      a--;
    }
    rn = random(a, b);
    if (col1.check() == 1) {
      analogWrite(pins[0], rn);
    }
    rn = random(a, b);
    if (col2.check() == 1) {
      analogWrite(pins[3], -rn);
    }
    rn = random(a, b);
    if (col3.check() == 1) {
      analogWrite(pins[6], -rn);
    }
  }
}

Comments