Where did I go wrong?


in project relays open per input voltage. in place of relay using leds. code input, led connected pin 38 high. other leds not getting on increase in voltage. connection leds correct because have used http://www.arduino.cc/en/tutorial/knightriderknight rider code check connection
code: [select]
const int analoginpin = a0;  // analog input pin potentiometer attached to
int sensorvalue = 0;        // value read pot
int outputvalue = 0;        // value output
int pinarray[] = {38, 39, 40, 41};
int count = 0;

void setup(){
  // make declarations @ once
  (count=0;count<4;count++) {
    pinmode(pinarray[count], output);
    digitalwrite(pinarray[count], low);
  }
}

void loop() {
  // read analog in value:
  sensorvalue = analogread(analoginpin);           
  // map range of analog out:
  outputvalue = map(sensorvalue, 0, 1023, 0, 125); 
  // change analog out value:

 
  if(sensorvalue = 1)
  { digitalwrite(38, high);
    digitalwrite(39, low);
    digitalwrite(40, low);
    digitalwrite(41, low);
  }

  else if(sensorvalue = 2)
  {
    digitalwrite(38, high);
    digitalwrite(39, high);
    digitalwrite(40, low);
    digitalwrite(41, low);
  }

  else if(sensorvalue = 3)
  { digitalwrite(38, high);
    digitalwrite(39, high);
    digitalwrite(40, high);
    digitalwrite(41, low);
  }
   else if(sensorvalue = 4)
  { digitalwrite(38, high);
    digitalwrite(39, high);
    digitalwrite(40, high);
    digitalwrite(41, high);
  }
   delay(2);
   
}   

which arduino have??


Arduino Forum > Using Arduino > Programming Questions > Where did I go wrong?


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

Rasperry Wifi LAN Controller - Raspberry Pi Forums

Unlock car with bluetooth and car key