Untitled Post

posted Dec 15, 2009, 8:59 AM by Unknown user
i, dylan, was absent yesterday. im glad to see how much ian got done without me. now we are mixing up a bunch of old programs to make the EMF work. in the ELSE we changed the DIGITALWRITE and LOW to PINMODE and INPUT, which accomplish the same thing of turning the leds off when no signal is dedected, but is need to work with our arrays. now im taking the potentimeter program where we use the pot. to light up more or less leds. we're taking the IF out of it and using it, taking the val. of the antena to determine how many leds light up.

int plus [] =  {8, 13, 12, 9, 8, 12, 13, 8, 9, 11, 13, 9, 10, 11, 11, 10, 10, 8, 12, 13, 9, 10, 10, 11, 12, 13, 12, 11, 9, 8};
int minus [] = {12, 8, 8, 12, 13, 9, 9, 11, 13, 8, 10, 11, 13, 9, 13, 12, 8, 10, 10, 11, 8, 9, 11, 12, 13, 12, 11, 10, 10, 9};
int inPin = 1;
int val = 0;


void setup() {
 
  Serial.begin(9600);
  
for(int pin = 8; pin < 13; pin++)
{
pinMode(pin,OUTPUT); 
}
 
}

void loop() {
 
  val = analogRead(inPin);                    // reads in the values from analog 5 and
                                                                   //assigns them to val
  if(val >= 1){
      
    val = constrain(val, 0, 100);    // mess with these values                                     
      



for(int x=0; x<val; x++)
{
   pinMode(Plus[x], OUTPUT);
   pinMode(Minus[x],OUTPUT);
 digitalWrite(Plus[x],HIGH);
 digitalWrite(Minus[x], LOW);
        delayMicroseconds(100);
   pinMode(Plus[x], INPUT);
   pinMode(Minus[x],INPUT);
  }
 
                                             




  }else{           


 
  for(int pin = 8; pin < 13; pin++)
{
pinMode(pin,INPUT); 
}
    
    
   }
 
 
 Serial.println(val);                               
 

  
  
  
}



Comments