Created
May 3, 2013 17:38
-
-
Save rohityadavcloud/5511771 to your computer and use it in GitHub Desktop.
Arduino hack @wingify, our resident alcohol breathlyzer
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
int sensorValue; | |
void setup() | |
{ | |
Serial.begin(9600); // sets the serial port to 9600 | |
} | |
void loop() | |
{ | |
sensorValue = analogRead(0); // read analog input pin 0 | |
int level = map(sensorValue, 500, 780, 0, 10); | |
if (level < 0) | |
level = 0; | |
if (level > 10) | |
level = 10; | |
Serial.println(level, DEC); // prints the value read | |
delay(100); // wait 100ms for next reading | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment