Skip to content

Instantly share code, notes, and snippets.

@omiq
Created October 31, 2017 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omiq/199b49773ae084c81e07d18a66d72c94 to your computer and use it in GitHub Desktop.
Save omiq/199b49773ae084c81e07d18a66d72c94 to your computer and use it in GitHub Desktop.
Random lights
void setup() {
// put your setup code here, to run once:
pinMode(A0,OUTPUT);
pinMode(A1,OUTPUT);
randomSeed(42);
}
void loop() {
// put your main code here, to run repeatedly:
int bright;
// set the brightness to a random num
bright = random(0,255);
// turn on LEDs
analogWrite(A0,bright);
analogWrite(A1,bright);
delay(100);
// turn off LEDs
analogWrite(A0,50);
analogWrite(A1,50);
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment