int red = 9; int blue = 7; int green = 8; String rH; String gH; String bH; int rV; int gV; int bV; long counter; String COLOUR = "#0000e0"; void setup() { // put your setup code here, to run once: counter = 0; pinMode(red,OUTPUT); pinMode(green,OUTPUT); pinMode(blue,OUTPUT); rH = COLOUR.charAt(1); rH.concat(COLOUR.charAt(2)); gH = COLOUR.charAt(3); gH.concat(COLOUR.charAt(4)); bH = COLOUR.charAt(5); bH.concat(COLOUR.charAt(6)); //base is 16, as long as input is fine, this should work rV = strtoul(rH.c_str(),NULL,16); gV = strtoul(gH.c_str(),NULL,16); bV = strtoul(bH.c_str(),NULL,16); Serial.begin(9600); Serial.println(rV); Serial.println(gV); Serial.println(bV); } void loop() { // put your main code here, to run repeatedly: // modulus will reach 0 at counter = 256 int temp = counter % 256; // any above 0 value of rV will get red led to glow // or any value that is less than the counter if (temp < rV) { digitalWrite(red,HIGH); } else { digitalWrite(red,LOW); } if (temp < gV) { digitalWrite(green,HIGH); } else { digitalWrite(green,LOW); } if (temp < bV) { digitalWrite(blue,HIGH); } else { digitalWrite(blue,LOW); } counter += 1; delayMicroseconds(10); }