Skip to content

Instantly share code, notes, and snippets.

@cswingler
Created April 29, 2011 16:11
Show Gist options
  • Save cswingler/948545 to your computer and use it in GitHub Desktop.
Save cswingler/948545 to your computer and use it in GitHub Desktop.
/*
Random Blink
This just randomly picks a value and analogWrite()s it to the LED
pin.
*/
/*
int ledPin = 9;
int RAND_MAX = 100;
*/
void setup() {
// we do nothing!
}
void loop() {
// Randomly set the pin to the value
// crap I don't remember how to generate random numbers in C++ :(
int rand_val = rand() % 100;
analogWrite(9, rand_val);
// Wait 30 microseconds to see it
delay (30);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment