Blok Diagram Rice Cooker
Flowchart Cara Kerja Rice Cooker
Program ARDUINO
int proses = 0 ;
int sensor1=A1;
int sensor2=A2;
int tombol=2;
int heater1=3;
int heater2=4;
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 8, 7, 6, 5);
void setup() {
//Serial.begin(9600);
pinMode(13,OUTPUT);
pinMode(2,INPUT);
lcd.begin(16,2);
}
void loop() {
//Serial.print("proses ");
//Serial.print(proses);
//Serial.print(" sensor1 ");
//Serial.print(sensor1);
//Serial.print(" sensor2 ");
//Serial.println(sensor2);
if (proses==0){
lcd.setCursor(1,1);
lcd.print("WARM");
}
else {
lcd.setCursor(1,1);
lcd.print("COOK");
}
lcd.setCursor(1,0);
lcd.print("S1= C");
lcd.setCursor(4,0);
lcd.print(sensor1);
lcd.setCursor(8,0);
lcd.print(";S2= C" );
lcd.setCursor(12,0);
lcd.print(sensor2);
if (digitalRead(2)==HIGH){
proses = 1;
delay(200);
}
if (proses == 0 ){
sensor2=analogRead(2)*0.49;
sensor1=analogRead(1)*0.49;
if (sensor2 <30){
digitalWrite(13,HIGH);
digitalWrite(heater2,HIGH);
}
else if (sensor2>33){
digitalWrite(13,LOW);
digitalWrite(heater2,LOW);
}
}
if(proses == 1){
sensor1=analogRead(1)*0.49;
if (sensor1 <32){
digitalWrite(13,HIGH);
digitalWrite(heater1,HIGH);
}
else if (sensor1 >33){
digitalWrite(13,LOW);
digitalWrite(heater1,LOW);
proses = 0;
}
}
delay(1000);
}
Tidak ada komentar:
Posting Komentar