Flashing LED with pot and RNG function help?

I am trying to get an LED to flash, using a potentiometer to control the delay. I would also like to use the random command to control the delay, activated by a switch. The last thing i want is to have a switch that will turn off the LEDs but when it is off i would like another led, preferably on a PWM pin, to turn on. i am using a UNO and so far have had no luck in autodesk circuits. Thanks for taking time to help me out!
prototype HERE

Show us your code and wiring and we'll help you get it right. But we can't help you without seeing what you have. Or were you wanting someone to just write the code for you? We have a separate section of the forum for that. It's called "Gigs and Collaborations" and you can post your requirements there but be prepared to pay someone to write up the code.

sorry, updated to include prototype link

check your code

int rng = [color=red]A2[/color]; // switch for activating the random delay


    if (analogRead(pwr) == 1023) {
      if (analogRead([color=red]rng[/color]) [color=red]== HIGH[/color]) {

the red part is probably not what you intend to do, right? (HIGH is 1 not 1023)

also, reading analog lines, You should check for a range in real life because you are not guaranteed to get exactly 1023 if you don't have pure power supply

i fixed the what was in red, do you think something like

if (analogRead(rng) < 500) {

would be safer to use?

500 out of 1024 is pretty large bet to say it's grounded but yes that should work.

    if (analogRead(pwr) [color=red]== 1023[/color]) {

I would fix that one too with a > 900 for example

i think ill have to physically try that one because it seems to logically work but the simulator seems to have issues with it.

Can you check you really read 1023 or close to when you toggle one of your switch?

If you have a switch hooked to A2 and not a potentiometer, you should be using digitalRead. It works on analog pins too.