Professional Documents
Culture Documents
Arduino Forum
Using Arduino => Project Guidance => Topic started by: ping25 on May 22, 2018, 02:18 pm
Look at the "Blink without Delay" sketch in the Arduino IDE under File > examples > digital.
In principle, you set a timer with the current value of millis() and when the timer expires after X
milliseconds, you stop the buzzer.
Code: [Select]
#include <LiquidCrystal.h> //memanggil library LCD
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // pin LCD
int tempPin = A0; // output pin sensor suhu
int fan = 9; // output pin kipas
int heater = 8; // output pin pemanas
int temp; //inisialisasi
int buzzer = 6; //alarm pin
void setup() {
pinMode(fan, OUTPUT); //pin kipas sebagai output
pinMode(heater, OUTPUT);//pin pemanas sebagai output
pinMode(tempPin, INPUT);//pin sensor suhu sebagai output
pinMode(buzzer, OUTPUT);
lcd.begin(16, 2); //sintaks lcd yang digunakan 16x2
}
void loop() {
temp = readTemp(); // membaca suhu
lcd.setCursor(0, 0); // penulisan karakter lcd kolom 0 baris 0
lcd.print("Temperature="); //menampilkan karakter di lcd
lcd.setCursor(0, 1); // penulisan karakter lcd kolom 0 baris 1
lcd.print(temp); //menampilkan hasil suhu
lcd.println("\337C");//menampilkan pada baris baru
Please post code using code tags so more people can see it.
Quote
i have try it. but it doesnt work.
the buzzer wont stop and the fan doesnt work
So post the new code you have tried, along with the schematic for the circuit you have built! We are
NOT mind readers.
Code: [Select]
#include <LiquidCrystal.h> //memanggil library LCD
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // pin LCD
int tempPin = A0; // output pin sensor suhu
int fan = 9; // output pin kipas
int heater = 8; // output pin pemanas
int temp; //inisialisasi
int buzzer = 6; //alarm pin
void setup() {
pinMode(fan, OUTPUT); //pin kipas sebagai output
pinMode(heater, OUTPUT);//pin pemanas sebagai output
pinMode(tempPin, INPUT);//pin sensor suhu sebagai output
pinMode(buzzer, OUTPUT);
lcd.begin(16, 2); //sintaks lcd yang digunakan 16x2
}
void loop() {
temp = readTemp(); // membaca suhu
lcd.setCursor(0, 0); // penulisan karakter lcd kolom 0 baris 0
Please post code using code tags so more people can see it.