Created
January 25, 2012 10:24
-
-
Save skwashd/1675753 to your computer and use it in GitHub Desktop.
Arduino LeoStick "Police Car"
This file contains hidden or 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
/** | |
* 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