Photocells. multiplexer and firmata

I am using an arduino uno and a multiplexer with eight photocells. I made an array for the photocells and made them be set in the for loop that selects different sensors in the multiplexer. The problem is that the variables for the photocells all get set to the same value.
I put this in programming questions because I am fairly confident that it is a problem in the code and not with the hardware.
Here’s my code:

Note: This code is not entirely mine and I am not taking full credit for it

import org.firmata.*;
import cc.arduino.*;
import processing.serial.*;

int r0 = 0;      // value select pin at the 4051 (s0)
int r1 = 0;      // value select pin at the 4051 (s1)
int r2 = 0;      // value select pin at the 4051 (s2)
int row = 0;     // storing the bin code
int count = 0;  // just a count
int[] ldr = new int[8]; // number of LDRs connected
int  bin [] = 
{
  000, 1, 10, 11, 100, 101, 110, 111 // bin 
};

Arduino arduino;

void setup()
{
  background(255);
  size(500, 500);
  arduino = new Arduino(this, Arduino.list()[0], 57600);

  arduino.pinMode(2, arduino.OUTPUT);    // s0
  arduino.pinMode(3, arduino.OUTPUT);    // s1
  arduino.pinMode(4, arduino.OUTPUT);    // s2
}

void draw()
{
  background(255);
  
  for (count=0; count<=7; count++) 
  {
    row = bin[count];      
    r0 = row & 0x01;
    r1 = (row>>1) & 0x01;
    r2 = (row>>2) & 0x01;
    arduino.digitalWrite(2, r0);
    arduino.digitalWrite(3, r1);
    arduino.digitalWrite(4, r2);
    
    ldr[count]=arduino.analogRead(0); // Set each element of ldr value of the corresponding sensor
  }

  fill(0);
  text("LDR 0: "+ldr[0], 10, 30);
  text("LDR 1: "+ldr[1], 10, 40);
}
int  bin [] = 
{
  000, 1, 10, 11, 100, 101, 110, 111 // bin 
};

You do realize that those are decimal values, not binary, right? Base 10.

...and that, if you make them binary, you have an array of consecutive values from 0 to 7? so that bin[count] has exactly the same value as count, for any positive integer less than 8? Hence, is completely redundant? ;)

I put this in programming questions because I am fairly confident that it is a problem in the code and not with the hardware.

Did that crap even compile for the Arduino? I don't think so!