Nofew

Untitled

Jun 17th, 2012
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.34 KB | None | 0 0
  1. #include <Metro.h>
  2.  
  3. const int pins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10};
  4.  
  5. void setup() {
  6.   Serial.begin(9600);
  7.   int i;
  8.   Serial.println(i);
  9.   for(i=0;i<9;i++) {
  10.     pinMode(pins[i], OUTPUT);
  11.     //Serial.println(i);
  12.   }
  13.   for(i=0;i<3;i++) {
  14.     digitalWrite(pins[i], LOW);
  15.     //Serial.println(i);
  16.   }
  17.   for(i=3;i<9;i++) {
  18.     digitalWrite(pins[i], HIGH);
  19.     //Serial.println(i);
  20.   }
  21.   randomSeed(7);
  22. }
  23.  
  24. void loop() {
  25.   int rn = 0;
  26.   analogWrite(pins[5], 247);
  27.   analogWrite(pins[8], 247);
  28.   analogWrite(pins[1], 11);
  29.   Metro col1 = Metro(80);
  30.   Metro col2 = Metro(100);
  31.   Metro col3 = Metro(120);
  32.   Metro change = Metro(100);
  33.   const short int DIFF = 65;
  34.   /* The idea is that we set the default for "flame orange"
  35.   right here first, then the code below slowly changes it.
  36.   Somehow.
  37.  
  38.   ...Wait. How do I ever, what is this...*/
  39.   short int b = 190+DIFF;
  40.   short int a = 190-DIFF;
  41.   short int d = 0;
  42.   short int c = 0;
  43.   short int f = 0;
  44.   short int e = 0;
  45.  
  46.   while(1) {
  47.     if (change.check() == 1) {
  48.       b--;
  49.       a--;
  50.     }
  51.     rn = random(a, b);
  52.     if (col1.check() == 1) {
  53.       analogWrite(pins[0], rn);
  54.     }
  55.     rn = random(a, b);
  56.     if (col2.check() == 1) {
  57.       analogWrite(pins[3], -rn);
  58.     }
  59.     rn = random(a, b);
  60.     if (col3.check() == 1) {
  61.       analogWrite(pins[6], -rn);
  62.     }
  63.   }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment