Skip to content

Instantly share code, notes, and snippets.

@skwashd
Created January 25, 2012 10:24
Show Gist options
  • Save skwashd/1675753 to your computer and use it in GitHub Desktop.
Save skwashd/1675753 to your computer and use it in GitHub Desktop.
Arduino LeoStick "Police Car"
/**
* Arduino LeoStick "Police Car"
*
* Written by Dave Hall - http://davehall.com.au
*
* Licensed under the terms of the WTFPL - http://sam.zoy.org/wtfpl/
*/
int SPEAKER = 11;
int LED_GREEN = 9;
int LED_BLUE = 10;
int LED_RED = 13;
int DELAY = 250;
void setup() {
pinMode(SPEAKER, OUTPUT);
pinMode(LED_GREEN, OUTPUT); // unused
pinMode(LED_BLUE, OUTPUT);
pinMode(LED_RED, OUTPUT);
}
void loop() {
analogWrite(SPEAKER, 175);
digitalWrite(LED_RED, LOW);
digitalWrite(LED_BLUE, HIGH);
delay(DELAY);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_BLUE, LOW);
delay(DELAY);
analogWrite(SPEAKER, 125);
digitalWrite(LED_RED, LOW);
digitalWrite(LED_BLUE, HIGH);
delay(DELAY);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_BLUE, LOW);
delay(DELAY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment