Last active
December 28, 2015 10:53
-
-
Save mbmjertan/ebb2cfd05c58af03a872 to your computer and use it in GitHub Desktop.
Croduino progam 1
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
const int DO_pin = 2; | |
const int AO_pin = 0; | |
int sound; | |
int led1 = 8; | |
int led2 = 9; | |
void setup(){ | |
pinMode(DO_pin, INPUT); | |
pinMode(led1, OUTPUT); | |
pinMode(led2, OUTPUT); | |
} | |
void loop(){ | |
if (sound > 28){ | |
digitalWrite(led1, HIGH); | |
} | |
if (sound < 25) { | |
digitalWrite(led1, LOW); | |
} | |
if (sound > 30){ | |
digitalWrite(led2, HIGH); | |
} | |
if (sound < 30){ | |
digitalWrite(led2, LOW); | |
} | |
sound = analogRead(AO_pin); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment