Right well got 2 lighting outputs running together and it works very well

The first is an array of common cathode RGB LEDs where each colour R,G and B runs off a separate PWM pin.
The second is a number of randomly flashing LEDs (I use 5 - each off a separate digital pin).
There are two potentiometers, one to control the brightness of th RGB array, and the other to control the hue. This second pot also controls the speed at which the random flashes fire but I will get a 3rd pot to do this I think..
There are also two switches connected to digital pins. One switch toggles the random flashes on and off, the other switches it from adjustable colour to white (R,G & B all full). I'm not sure if I'll keep it this way but it works for now.
Here's the code:
// Potentiometers
const int hpotpin = 1; // Hue input connected to digital pin 1
const int fpotpin = 0; // Fade input connected to digital pin 1
// switches
#define swPin 2 // pin for RGB LED array switch input - note: no semicolon after #define
int stateA, stateB; // variables to store pin states
int sw1, sw2; // variables to represent switch states
#define sw2Pin 0 // pin for blinking switch input - note: no semicolon after #define
int state2A, state2B; // variables to store pin states
int sw21, sw22; // variables to represent switch states
// RGB LEDs (3 pwm pins to allow for brightness control)
int rpin = 10; //PWM pin for red in RGB LEDs
int gpin = 6; //PWM pin for green in RGB LEDs
int bpin = 11; //PWM pin for blue in RGB LEDs
// Blinking LEDs
#define numberOfLEDs 5
long nextFlash[5]; //Not sure whether this number has to be the same as the number of leds?
int ledPin[] = { 4, 5, 8, 12, 13 }; // LED pins to use.
int ledState[5]; //Not sure about this either
const int FlashDuration=10; //Fixed length time in millisecs for led to stay on
// For calculating the hue value and converting to RGB
float h;
int h_int; //Hue value (temperature)
int r=0, g=0, b=0;
int hval=0;
void h2rgb(float h, int &r, int &g, int &b);
// these variables store the values for the fade knob and LED level
int fpotpinValue, fval;
void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bps
for(int i = 0; i<numberOfLEDs; i++){
pinMode(ledPin[i],OUTPUT);
ledState[i] = LOW;
digitalWrite(ledPin[i], LOW); // all LEDs off
nextFlash[i] = millis() +random(1, 5000);
}
}
void loop()
{
// Switch 1 - RGB LED array
digitalWrite(swPin, LOW); // make sure the puillup resistors are off
stateA = digitalRead(swPin);
digitalWrite(swPin, HIGH); // turn on the puillup resistors
stateB = digitalRead(swPin);
if ( stateA == 1 && stateB == 1 ){ // both states HIGH - switch 1 must be pushed
sw1 = 1;
sw2 = 0;
//switch state for off
// read the value from the input
fpotpinValue = analogRead(fpotpin);
// remap the values from 10 bit input to 8 bit output
fval = map(fpotpinValue, 0, 1023, 0 , 254);
// use the input value to fade the led in white
analogWrite(rpin, fval);
analogWrite(gpin, fval);
analogWrite(bpin, fval);
// switch state end
}
else if ( stateA == 0 && stateB == 0 ){ // both states LOW - switch 2 must be pushed
sw1 = 0;
sw2 = 1;
//switch state for on
// Two pot controlled RGB LEDs
hval=analogRead(hpotpin); // Hue pot
fpotpinValue=analogRead(fpotpin); // Fade Pot
fval = map(fpotpinValue, 0, 1023, 0 , 255); // remap the values from 10 bit input to percentage
h = ((float)hval)/1024;
h_int = (int) 360*h;
h2rgb(h,r,g,b);
analogWrite(rpin, r);
analogWrite(gpin, g);
analogWrite(bpin, b);
// RGB LEDs end
// switch state end
}
else{ // stateA HIGH and stateB LOW
sw1 = 0; // no switches pushed - or center-off toggle in middle position
sw2 = 0;
}
// Switch 1 - End
// Switch 2 - Blinking LEDs
digitalWrite(sw2Pin, LOW); // make sure the puillup resistors are off
state2A = digitalRead(sw2Pin);
digitalWrite(sw2Pin, HIGH); // turn on the puillup resistors
state2B = digitalRead(sw2Pin);
if ( state2A == 1 && state2B == 1 ){ // both states HIGH - switch 1 must be pushed
sw21 = 1;
sw22 = 0;
//switch state for off
// switch state end
}
else if ( state2A == 0 && state2B == 0 ){ // both states LOW - switch 2 must be pushed
sw21 = 0;
sw22 = 1;
//switch state for on
//Blinking
// read the value from the input
fpotpinValue = analogRead(fpotpin);
// remap the values from 10 bit input to 8 bit output
fadeValue = map(fpotpinValue, 0, 1023, 10 , 5000); //Milliseconds
for(int i = 0; i<numberOfLEDs; i++)
{
if(millis() > nextFlash[i])
{
ledState[i]=!ledState[i];
if(ledState[i]) //Led is going on, set to fixed length of flash
nextFlash[i] = millis()+FlashDuration;
else
nextFlash[i] = millis()+random(10, fadeValue) ; // led stays off for random interval
digitalWrite(ledPin[i],ledState[i]);
}
}
// Blinking end
// switch state end
}
else{ // stateA HIGH and stateB LOW
sw21 = 0; // no switches pushed - or center-off toggle in middle position
sw22 = 0;
}
// Switch 2 - End
} //Loop End
// Sub routine for converting the HUE to RGB
void h2rgb(float H, int &R, int&G, int&B) {
int var_i;
float S=1, V=1, var_1, var_2, var_3, var_h, var_r, var_g, var_b;
if ( S == 0 ) //HSV values = 0 ÷ 1
{
R = V * 255;
G = V * 255;
B = V * 255;
}
else
{
var_h = H * 6;
if ( var_h == 6 ) var_h = 0; //H must be < 1
var_i = int( var_h ) ; //Or ... var_i = floor( var_h )
var_1 = V * ( 1 - S );
var_2 = V * ( 1 - S * ( var_h - var_i ) );
var_3 = V * ( 1 - S * ( 1 - ( var_h - var_i ) ) );
if ( var_i == 0 ) {
var_r = V ;
var_g = var_3 ;
var_b = var_1 ;
}
else if ( var_i == 1 ) {
var_r = var_2 ;
var_g = V ;
var_b = var_1 ;
}
else if ( var_i == 2 ) {
var_r = var_1 ;
var_g = V ;
var_b = var_3 ;
}
else if ( var_i == 3 ) {
var_r = var_1 ;
var_g = var_2 ;
var_b = V ;
}
else if ( var_i == 4 ) {
var_r = var_3 ;
var_g = var_1 ;
var_b = V ;
}
else {
var_r = V ;
var_g = var_1 ;
var_b = var_2 ;
}
R = (1-var_r) * fval; //RGB results = 0 ÷ fade value from pot
G = (1-var_g) * fval; //In effect we are creating the L value of the HSL colour model
B = (1-var_b) * fval;
}
}
Attached is a breadboard drawing that I did in fritzing.
Lastly here's a video of it in action

(not sure how to embed youtube in this post)...
Thanks for all your help... I've learnt a lot! cheers. The next step is to get a laser firing randomly and introduce a disposable camera flash flashing randomly.... Hopefully I'll learn a bit about opto-isolators, relays, mosfets and capacitors.... maybe transistors too.