Alcohol Detector อุปกรณ์ - MQ-3 alcohol sensor - Arduino uno - 10pcs 5V active buzzer - Microtivity IM206 6x6x6mm tact switch - 12C LCD screen - 10 kOhm resistor - Breadboard - 10 X male/male jumper wires - 10 X male/female jumper wires Diagram Code #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27,20,4); const int buttonPin = 2; const int buzzerPin = 7; const int AOUTpin=0;//the AOUT pin of the alcohol sensor goes into analog pin A0 of the arduino const int DOUTpin=8;//the DOUT pin of the alcohol sensor goes into digital pin D8 of the arduino const int ledPin=13;//the anode of the LED connects to digital pin D13 of the arduino int ledpin1 = 3; int ledpin2 = 4; int ledpin3 = 5; int limit; int value; int buttonState = 0; void setup() { Serial.begin(9600); lcd.init(); lcd.backlight(); pinMode(buttonPin, INPUT); pinMode(buzzerPin,OUTPUT); pinMode(DOUTpin, INPUT);//sets the
Frequency Counter อุปกรณ์ 555 timer IC and 74LS14 Schmitt trigger gate or NOT gate. 1K Ω resistor(2 pieces), 100Ω resistor 100nF capacitor (2 pieces), 1000µF capacitor 16*2 LCD, 47KΩ pot, Breadboard and some connectors. Diagram Code #include <LiquidCrystal.h> LiquidCrystal lcd(2, 3, 4, 5, 6, 7); int Htime; //สร้างตัวแปรชื่อHtime int Ltime; //สร้างตัวแปรชื่อLtime float Ttime; // สร้างตัวแปรชื่อ Ttime float frequency; //เรียงความถี่ void setup() { pinMode(8,INPUT); lcd.begin(16, 2); } void loop() { lcd.clear(); lcd.setCursor(0,0); lcd.print("Frequency of signal"); Htime=pulseIn(8,HIGH); //อ่านค่าHigh Ltime=pulseIn(8,LOW); //อ่านค่าLow Ttime = Htime+Ltime; frequency=1000000/Ttime; //รับค่าความถี่กับเวลา lcd.setCursor(0,1); lcd.print(frequency); lcd.print(" Hz"); delay(500); } Credit By : https: