Created
May 21, 2015 14:52
-
-
Save t-kashima/53b87ef68eab67696926 to your computer and use it in GitHub Desktop.
Red-rays distance sensor for Android
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
void setup() { | |
Serial.begin(9600); | |
pinMode(11, OUTPUT); | |
digitalWrite(11, HIGH); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
int sum = 0; | |
for (int i = 0; i < 100; i++) { | |
sum += analogRead(0); | |
} | |
int average = sum / 100; | |
Serial.println(average); | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment