LED program not working need help dont know why
im creating a program on vb that controls leds the vb program generates a 5bit binary number which i have then ported to arduino. i then want arduino to read each bit separately and then check if its a 1 or 0
Below is code
void setup (){
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
Serial.begin(9600);
}
void loop(){
int Portresult;
int val;
int bitval;
int counter = 0;
for ( counter=0; counter = 5; counter++){
bitRead(Portresult,counter);
val=bit(counter);
counter = counter + 2;
if(val=='1') { digitalWrite(counter,HIGH) ; }
else if (val=='0') {digitalWrite(counter,LOW);
}
}
}