Skip to main content
2 of 5
added 263 characters in body

New to Arduino and I have a WIP code for a class. ERROR with LEDs working?

(EDIT) My goal with this code is to use two potentiometers, pot0 and pot1 respectively, to control 8 leds. Pot0 controls which sequence the leds are running (1, 2, or 3) and pot1 controls which LEDs within each sequence are active. Currently, I am having a problem because I am running Sequence 1 (the first if statement) to my arduino, but I can only get LED 6 and 7 (mapped to port 1 and 0 respectively) to light up no matter how I turn my potentiometers. Is there something wrong with my code? (Code is WIP)

int pot0 = 0;
int pot1 = 1;
int led[] = {7, 6, 5, 4, 3, 2, 1, 0};



void setup() {

for (int i = 0; i < led; i++){
  pinMode(led, OUTPUT)
;}
}
void loop() {
  analogRead(pot0);
  int val = analogRead(pot1);
  int potR = val % 8;

if (pot0 <= 341) {
  for (int i; i == potR;)
  digitalWrite(led[i], HIGH);
}

else if (pot0 <= 682) {
  
}
else {
  
}
}