int light = 0; void setup() { } void loop() { int ss = 30; // sample size for light sensor int average = 0; for (int x = 0; x < ss; x++) { average += analogRead(light); delay(1); } average /= ss; String bitIn = ""; for(int x = 0; x <9; x++) { bitIn += average >> x; } int a = bitIn.substring(0, 3).toInt(); int b = bitIn.substring(3, 6).toInt(); int c = bitIn.substring(6, 9).toInt(); // set LED strips to c, b, a (in order RGB) }