Created
January 8, 2019 10:41
-
-
Save yaleman/1ca1599830cb79fcb4cb812935378908 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// led bank 1 enable pin | |
int EnA = 10; | |
// led bank 2 enable pin | |
int EnB = 5; | |
int In1 = 9; | |
int In2 = 8; | |
int In3 = 7; | |
int In4 = 6; | |
long randNumber; | |
void setup() | |
{ | |
// All control pins are outputs | |
pinMode(EnA, OUTPUT); | |
pinMode(EnB, OUTPUT); | |
pinMode(In1, OUTPUT); | |
pinMode(In2, OUTPUT); | |
pinMode(In3, OUTPUT); | |
pinMode(In4, OUTPUT); | |
} | |
void loop() | |
{ | |
randomSeed(analogRead(0)); | |
randNumber = random(255); | |
// turn on bank a | |
digitalWrite(In1, HIGH); | |
digitalWrite(In2, LOW); | |
// set value to random out 255 | |
analogWrite(EnA, randNumber); | |
randomSeed(analogRead(0)); | |
randNumber = random(255); | |
// turn on bank B | |
digitalWrite(In3, HIGH); | |
digitalWrite(In4, LOW); | |
analogWrite(EnB, randNumber); | |
randomSeed(analogRead(0)); | |
randNumber = random(255); | |
delay(random(20)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment