I'm currently working on a bit of a mini project involving an alcohol breathalyzer and I'm having trouble with a piece of code I got off the internet but I don't fully understand how the results comes from.
When I run the test on the arduino I managed to get the BAC (Blood Alcohol Content) levels but I don't understand how the code gets that when it measurings your level. I'm currently based in Ireland which means there's a limit to how much you can drink before you drive and the BAC measures the amount of alcohol you have in your system in grams of alcohol per 100 millilitres of blood. A BAC of 0.05 means you have 0.05 grams (50 milligrams) of alcohol in every 100 millilitres of blood.
How does this code work correctly with the code I've inserted into this post?
The code 'fragment' isn't enough to answer the question. You need to post the entire program... not where you 'think' the problem lies.
Somewhere you are getting the 'AlcoValue' and it's not in the listed code segment.
Most countries have a legislated BrAC (breath alcohol concentration) level for intoxication, some are zero. I'm assuming this sensor isn't for an actual blood and is a breath sensor.
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for advice on (nor for problems with) your project.
With the MQ type sensors, the readings are actually meaningless until the sensor has been "burned in" for 48 to 72 hours, and calibrated against known standards. See the manufacturer's data sheet.
Where does AlcoValue come from?
What type of variable is it?
Why is it divided by 10?
Where did the value "0.67" come from?
Does it represent 2/3rds (0.6666...) rounded to two decimal places?