Breathalyzer 2. Arduino (6 / 10 stap)

Stap 6: Code

 #include <Adafruit_Thermal.h> 
 #define qtyLED 6 //Declare the quantity of LED's for the bar graph 
 <adafruit_thermal.h><br>#include <SoftwareSerial.h><softwareserial.h> SoftwareSerial mySerial(0, 1); Adafruit_Thermal printer(&mySerial); int printer_RX_Pin = 0; int printer_TX_Pin = 1; int LEDs[qtyLED]; //Array to store the states of the LEDs int sensorPin = 0; //Variable that will hold the current value of the sensor int time; //Variable that will hold the amount of time for the sensor to be read int maxreading; //Variable to store the maximum value read during the last reading //For loop counting variables int i; int j; void setup() { mySerial.begin(19200); printer.begin();</softwareserial.h></adafruit_thermal.h> 
 //Initialize the counting variables i=0; j=2; while(i < qtyLED) //While i is less than the number of defined LED's { //...save the value of i+2 in the LEDs array. we add 2 so that it represents one of our digital pins LEDs[i] = j; i++; j++; } for(i=0;i<qtyled;i++) define="" the="" led="" pins="" as="" outputs.="" in="" this="" case="" 2-="">7 { pinMode(LEDs[i], OUTPUT); } pinMode(13, OUTPUT); //Define pin 13 as an output so we can show when we are not taking a reading from the sensor(Blinkin //...Or when we are taking a reading from the sensor (Solid) }</qtyled;i++)> 
 void loop() { PORTB = PORTB ^ 100000; //Invert pin 13 to give the LED a blinking effect delay(100); //Delay so that the user can see the blinking happen int sensor = analogRead(sensorPin); //Read the sensors value and store it in the sensor variable if(sensor >= 40) //If the value is less that 40(value for the chemical being used in this example) { printer.println("Breathalyzer 2.Arduino"); //printer will start and print the first statement (if the value is less than 40) printer.print("Hey! Look at you! "); printer.print("You are sober!! That's a shocker!"); printer.feed(); printer.println("Now quick, before your friends call you back over for that next shot you should just go home"); printer.println("Doesn't Netflix and a bed sound fun?"); printer.println("If that doesn't tickle your fancy and you plan on drinking tonight please call"); printer.feed(); printer.println("*850.433.3333*"); printer.feed(); printer.feed(); printer.feed(); printer.println("For entertainment purposes only"); printer.feed(); } { digitalWrite(13, HIGH); //Turn on the blue LED indecating that the sensor detected a minimal amount of alcohol (sensor >= 40) maxreading = 0; //Initiate the max reading to 0 for(time = 0;time <= 5000;time++) //Read the sensor for 5 seconds { //...every millisecond update the value of the max reading of the sensor int sensor = analogRead(sensorPin); delay(1); if(sensor > maxreading) { maxreading = sensor; } digitalWrite(13, LOW); //As soon as the reading is complete turn off the blue LED int level = map(maxreading, 0, 200, 0, qtyLED); //Map the value from 0 to 200(reading from sensor) to 0 and the number of LEDs which is 6 //...0 to 6(LEDs) level determines how many of them turn on. for(i=0;i<qtyled;i++) compare="" all="" the="" leds="" current="" state="" with="" value="" of="" level="" that="" was="" read="" ="" {="" if="" for="" example="" 5,="" then="" 2-="">6 would turn on. if (i < level) //If the current LED being checked is less that the level { printer.println("Breathalyzer 2.Arduino");//printer will start and print the first statement (if the value is between 40 and the max) printer.print("Well well well...."); printer.print("It looks like you've had a bit to drink. You should probably stop now. That's what all the cool kids are doing"); printer.feed(); printer.println("Besides, do you really want to be THAT GUY?"); printer.println("Now, go pay your bar tab and please call"); printer.feed(); printer.println("*850.433.3333*"); printer.feed(); printer.feed(); printer.feed(); printer.println("For entertainment purposes only"); printer.feed();{ digitalWrite(LEDs[i], HIGH); //...Turn it on } } else //If the current LED being checked is higher than the level { digitalWrite(LEDs[i], LOW); //...Turn it off } { printer.println("Breathalyzer 2.Arduino");//printer will start and print the first statement (if the value is at the maximum level) printer.print("HOT DOGGY"); printer.print("You are as drunk as a SKUNK!!"); printer.println("I could tell you pretty much anything right now and you wouldn't remember it"); printer.feed(); printer.println("fajksdfjalksfjalkdfja;l "); printer.println("Just Kidding! But Seriously, you should probably put that beer down and call"); printer.feed(); printer.println("*850.433.3333*"); printer.println("It's bedtime."); printer.feed(); printer.feed(); printer.feed(); printer.println("For entertainment purposes only"); printer.feed(); } } delay(10000); //Wait 10 seconds for the user to get the reading from the led bar graph for(i=0;i<qtyled;i++) turn="" off="" all="" the="" leds="" ="" {="" digitalwrite(leds[i],low);="" }="" }<="" p=""></qtyled;i++)></qtyled;i++)>],LOW); 
 } } } } 

Gerelateerde Artikelen

De bliksem Simulator/Breathalyzer/Graphic Equalizer - Arduino aangedreven

De bliksem Simulator/Breathalyzer/Graphic Equalizer - Arduino aangedreven

UPDATE: Een draagbare versie van de Breathalyzer praten is hier http://talkingbreathalyzer.com ***De LED strips zijn gemonteerd op een buiten trellace die als een bliksem simulator, buiten breathalyzer, grafische equalizer gesynchroniseerd met muziek
Arduino Breathalyzer

Arduino Breathalyzer

Wat is een breathalyzer die kunt u vragen? Het is een apparaat voor het schatten van bloedalcoholgehalte (BAC) uit een monster van de adem. In eenvoudige termen, die het is een apparaat om te testen is weer een persoon dronken of niet. Zoals de titel
SENSE: Slimme adem analyseapparaat (een slimme Breathalyzer)

SENSE: Slimme adem analyseapparaat (een slimme Breathalyzer)

Hallo iedereen,Ik ben Geeve George een 15-jarige Maker/elektronica Hobbyist.I liefde computervisie, Androïde ontwikkeling en algoritme Design.I ben momenteel in 11de rang Student informatica op Little Rock Indian School. :)Meer informatie vinden over
DIY Magic Mirror en Photobooth - Arduino Powered

DIY Magic Mirror en Photobooth - Arduino Powered

een geassembleerd kit voor dit project is nu beschikbaar bijSeeedstudio.comMeer info op dit project op http://diymagicmirror.com De software voor dit project is open source open sourceWie is de mooiste van allemaal. Maak uw eigen Magic Mirror en ontd
Yoga Breathalyzer

Yoga Breathalyzer

de yoga breathalyzer is een adem visualisatie tool waarmee u kunt begrijpen en neem contact op met je ademhaling. Adem is de basis van yoga en meditatie, en dit hulpprogramma biofeedback is een manier om het ontwikkelen van een dieper begrip van je e
Arduino Bac rekenmachine

Arduino Bac rekenmachine

Dit is een instructable op hoe maak je een eenvoudige schakeling met behulp van een sensor van de alcohol MQ-3 om te meten BAC niveau. We zullen gebruiken arduino code en een arduino schild lcd om het berekende niveau van de BAC weer te geven.Stap 1:
Breathalyzer microfoon

Breathalyzer microfoon

de microfoon breathalyzer is een systeem voor het verzamelen van de inconscpicuous van de bloed-alcohol inhoud niveau datasets. Met andere woorden, kunt u het meten van iemands soberheid met een apparaat, dat voor alle doeleinden, ziet er niet anders
DIY Portable Breathalyzer - afkomstig van BayLab voor de Instructables sponsoring programma

DIY Portable Breathalyzer - afkomstig van BayLab voor de Instructables sponsoring programma

detecteren uw BAC wih een pocket sized breathalyzer.Stap 1: DisclaimerVoordat we beginnen, een disclaimer. Dit is niet bedoeld om te worden gebruikt om te vertellen als je ok om te rijden bent of niet. Het is niet zo nauwkeurig als een politie breath
De Breathalyzer praten

De Breathalyzer praten

*** aanvullende info op http://droidalyzer.com/talkingbreathalyzer/ ***Video van de Breathalyzer praten in actie:Meer informatie over de Breathalyzer praten:Een aanpasbare Breathalyzer die praat en je vertelt hoeveel je hebt gehad om te drinken. Het
Arduino BAC Monitor

Arduino BAC Monitor

Het doel van dit project is met een arduino en een MQ-3 alcohol sensor te maken van een eenvoudige breathalyzer die toezicht houdt op BAC niveaus. Het project omvat het ontwerpen en bouwen van een eenvoudige schakeling en het schrijven van code in de
Remix Breathalyzer 2.0 (Alcohol Meter)

Remix Breathalyzer 2.0 (Alcohol Meter)

Bericht: Controleer uw stad schoon en zeg nee tegen polyester zakken, RECYCLE papieren zakken gebruikt. PLANT MEER BOMEN EN MAKEN DEZE AARDE GROEN. Oude recycle onderdelen te gebruiken voor projecten en sparen geld en milieu. :-)VERHAAL ACHTER DIT PR
UV Meter & Breathalyzer sleutelhanger - 3D afgedrukt - IoT Blynk

UV Meter & Breathalyzer sleutelhanger - 3D afgedrukt - IoT Blynk

Stel je de ideale strand reis. De zon schijnt, de hemel zijn blauw, het water is warm. U en uw vrienden hebben alles wat die u nodig hebt om te genieten van de zon, zand en surfen. Nou, vergeet niet de pijnstillende Aloë gel in uw koeler, voor die on
Glas van computers op basis van Arduino Uno

Glas van computers op basis van Arduino Uno

Aan mijn meesters graduate project ("Gowing Computers, aansluiten van organen, knippen het snoer") van Konstfack College van kunstnijverheid en Design (keramiek en glas/CRAFT) heb ik gemaakt 3 glazen computers op basis van de specificaties van d
Arduino temperatuurgevoelig Fan

Arduino temperatuurgevoelig Fan

Ik en een paar leden van de groep hebben besloten dat voor de zomer, zou gunstig zijn voor het maken van een ventilator die worden ingeschakeld bij 70 graden Fahrenheit en in intensiteit met de hitte blijft toenemen. Dus is dat wat we deden. :)Stap 1