Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Arduino hack @wingify, our resident alcohol breathlyzer
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
You can’t perform that action at this time.