Hello,
I am new to Arduino and have very limited knowledge of C++. I just bought an Arduino Uno and I'm waiting for it to arrive. In the meantime I'm just using a simulator to play with code.
I have this Random LED flasher below and it works great as-is, but I want to add (2) potentiometers: Pot1 to increase/decrease the time delay between flashes, and Pot2 to adjust the duration the LED is on.
-How would I wire the 2 Pots to the Arduino Uno?
-What value Pots do I need?
-What codes do I need to add to the code below to achieve this?
Thanks for the help!
-Joe
Here is the code that I have now:
//RANDOM LED FLASHER
int ranNum;
int ranDel;
void setup() {
// Seed RNG from analog port.
randomSeed(analogRead(0));
// Assign port 3 for LED
pinMode(3, OUTPUT);
}
void loop() {
ranNum=random(3,11); //Generate random number between 8 and 10
ranDel=random(3,400); // Generate random delay time
digitalWrite(ranNum, HIGH); //Turn on the LED
delay(ranDel);
digitalWrite(ranNum, LOW); //Turn off the LED
}