Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat berfungsi sebagai alat pencampur 2 larutan yaitu orbital shaker, tujuan utama alat ini yaitu mencampurkan 2 larutan yang berbeda menjadi 1 wadah larutan yang kemudian dilakukan pengadukan sehingga tercampur rata. proses pengadukan juga harus berjalan secara smoot / halus agar cairan didalam wadah tidak mengalami goncangan yang serius. untuk lebih jelasnya berikut adalah koding dan komponennya.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <MsTimer2.h>
#include <L298N.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 20 chars and 4 line display
//Motor DC - Driver Motor L298N
#define motor 10 //deklarasi pin 10 untuk mengatur kecepatan motor dengan mengubah nilai PWM
#define R_motor 9 //deklarasi pin 9 untuk mengatur arah putaran motor searah jarum jam
#define L_motor 8 //deklarasi pin 8 untuk mengatur arah putaran motor berlawanan arah jarum jam
//Water Pump - Driver Motor L298N
#define IN1 4 // deklarasi pin IN1 (drivermotor) terhubung ke pin 4 Arduino
#define IN2 5 // deklarasi pin IN2 (drivermotor) terhubung ke pin 5 Arduino
#define IN3 6 // deklarasi pin IN3 (drivermotor) terhubung ke pin 6 Arduino
#define IN4 7 // deklarasi pin IN4 (drivermotor) terhubung ke pin 7 Arduino
//Tombol - PullUpResistor
#define buttonUP A0 // deklarasi pin A0 sebagai tombol UP
#define buttonDOWN A1 // deklarasi pin A1 sebagai tombol DOWN
#define buttonBACK A2 // deklarasi pin A2 sebagai tombol BACK
#define buttonSTART A3 // deklarasi pin A3 sebagai tombol START
//Buzzer
#define buzzer 2 //deklarasi pin 13 untuk indikator buzzer
int menu=0;
int START=buttonSTART;
int BACK=buttonBACK;
int UP=buttonUP;
int DOWN=buttonDOWN;
int menit;
int detik;
int vol_1,vol_2;
int nextVol_1, nextVol_2;
int kec;
int setTimer=0;
float setpoints1;
float setpoints2;
float setpoints3;
void flash() {
detik--; }
void setup() {
//pengurangan detik
//deklarasi Motor DC
pinMode(motor,OUTPUT);
pinMode(R_motor,OUTPUT);
pinMode(L_motor,OUTPUT);
//deklarasi Tombol
pinMode(buttonUP, INPUT_PULLUP);
pinMode(buttonDOWN, INPUT_PULLUP);
pinMode(buttonSTART, INPUT_PULLUP);
pinMode(buttonBACK, INPUT_PULLUP);
//deklarasi Water Pump
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
//deklarasi Buzzer
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer,HIGH);
//pengurangan timer setiap 1 detik
MsTimer2::set(1000,flash);
//inisialisasi tampilan awal
nama();
menu=0;
}
void loop() {
switch (menu) {
case(0):
//Halaman awal menu berisi pemilihan Washing&Cleanser//
halaman1();
if (digitalRead(START)==LOW){klick();
delay(200);
lcd.clear();
menu=5;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=0;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=0;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=1;
}
break;
case(1):
//Halaman awal menu berisi pemilihan Setting Volume//
halaman2();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=9;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=1;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=0;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=2;
}
break;
case(2):
//Halaman awal menu berisi pemilihan Setting Kecepatan//
halaman3();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=15;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=2;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=1;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=3;
}
break;
case(3):
//Halaman awal menu berisi pemilihan Setting Timer//
halaman4();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=16;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=1;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=2;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=4;
}
break;
case(4):
//Halaman awal menu berisi pemilihan START//
halaman5();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=17;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=4;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=3;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=4;
}
break;
case(5):
//Halaman kesatu submenu Satu berisi pemilihan Washing//
subHalaman1();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=6;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=20;
}
break;
case(6):
//Halaman kedua submenu Satu berisi proses Washing//
subHalaman1_1();
menu=7;
break;
case(7):
//Halaman ketiga submenu Satu berisi pemilihan Cleanser//
subHalaman1_2();
if (digitalRead(START)==LOW){
klick();
delay(200);lcd.clear();menu=8;}
break;
case (8):
//Halaman keempat submenu Satu berisi proses Cleanser//
subHalaman1_3();
menu=1;
break;
case(9):
//Halaman kesatu submenu Dua berisi pemilihan Setting Volume I//
subHalaman2_1();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=10;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=1;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=12;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=12;
}
break;
case(10):
//Halaman kedua submenu Dua berisi pemilihan jumlah Volume I//
subHalaman2_1_1();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=11;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=9;
}
if (digitalRead(UP)==LOW&&vol_1<4){
klick();
delay(100);
vol_1++;
}
if (digitalRead(DOWN)==LOW&&vol_1>1){
klick();
delay(100);
vol_1--;
}
break;
case(11):
//Halaman ketiga submenu Dua berisi proses Volume I//
subHalaman2_1_2();
menu=12;
break;
case(12):
//Halaman kesatu submenu Dua berisi pemilihan Setting Volume II//
subHalaman2_2();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=13;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=1;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=9;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=9;
}
break;
case(13):
//Halaman kedua submenu Dua berisi pemilihan jumlah Volume II//
subHalaman2_2_1();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=14;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=12;
}
if (digitalRead(UP)==LOW&&vol_2<4){
klick();
delay(100);
vol_2++;
}
if (digitalRead(DOWN)==LOW&&vol_2>1){
klick();
delay(100);
vol_2--;
}
break;
case(14):
//Halaman ketiga submenu Dua berisi proses Volume II//
subHalaman2_2_2();
menu=25;
break;
case(15):
//Halaman awal submenu Tiga berisi pemilihan Kecepatan//
subHalaman3();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=3;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=2;
}
if (digitalRead(UP)==LOW&&kec<3){
klick();
delay(100);
kec++;
}
if (digitalRead(DOWN)==LOW&&kec>1){
klick();
delay(100);
kec--;
}
break;
case(16):
//Halaman awal submenu Empat berisi pemilihan Timer//
subHalaman4();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=4;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=3;
}
if (digitalRead(UP)==LOW&&setTimer<60){
klick();
delay(100);
setTimer++;
}
if (digitalRead(DOWN)==LOW&&setTimer>1){
klick();
delay(100);
setTimer-- ;
}
break;
case(17):
//Halaman kesatu submenu Lima berisi nilai Kecepatan dan Timer yang telah di setting//
subHalaman5();
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=4;
}
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
MsTimer2::start();
startMotor();
menu=18;}
break;
case(18):
//Halaman kedua submenu Lima berisi proses Running Motor dan Countdown Timer//
subHalaman5_1();
if (digitalRead(BACK)==LOW){
klick();
delay(200);
MsTimer2::stop();
stopMotor();
}
if (digitalRead(START)==LOW){
klick();
delay(100);
MsTimer2::start();
startMotor() ;
}
if (digitalRead(BACK)==LOW){
klick();
delay(2000);
lcd.clear();
menu=19;
}
if (detik<=0&&setTimer<=0){
detik=0;
lcd.clear();
menu=19;
}
break;
case(19):
//Halaman ketiga submenu Lima berisi proses selesai Running Motor dan Countdown Timer//
subHalaman5_2();
menu=20;
break;
case(20):
//Halaman awal menu berisi pemilihan Washing&Cleanser tanpa Pembersihan Selang//
nextHalaman1();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=5;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=20;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=20;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=21;
}
break;
case(21):
//Halaman awal menu berisi pemilihan Setting Volume tanpa Pembersihan Selang//
nextHalaman2();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=22;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=21;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=0;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=2;
}
break;
case(22):
//Halaman kesatu submenu Dua berisi pemilihan Setting Volume I tanpa Pembersihan Selang//
nextSubHalaman2_1();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=23;
}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=21;
}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=25;
}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=25;
}
break;
case(23):
//Halaman kedua submenu Dua berisi pemilihan jumlah Volume I tanpa Pembersihan Selang//
nextSubHalaman2_1_1();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=24;}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=22;}
if (digitalRead(UP)==LOW&&nextVol_1<4){
klick();
delay(100);
nextVol_1++;}
if (digitalRead(DOWN)==LOW&&nextVol_1>1){
klick();
delay(100);
nextVol_1--;}
break;
case(24):
//Halaman ketiga submenu Dua berisi proses Volume I tanpa Pembersihan Selang//
nextSubHalaman2_1_2(); menu=25;
break;
case(25):
//Halaman kesatu submenu Dua berisi pemilihan Setting Volume II tanpa Pembersihan Selang//
nextSubHalaman2_2();
if (digitalRead(START)==LOW){
klick();
delay(200);
lcd.clear();
menu=26;}
if (digitalRead(BACK)==LOW){
klick();
delay(200);
lcd.clear();
menu=21;}
if (digitalRead(UP)==LOW){
klick();
delay(200);
lcd.clear();
menu=22;}
if (digitalRead(DOWN)==LOW){
klick();
delay(200);
lcd.clear();
menu=22;}
break;
case(26):
//Halaman kedua submenu Dua berisi pemilihan jumlah Volume II tanpa Pembersihan Selang//
nextSubHalaman2_2_1();
if (digitalRead(START)==LOW){klick();delay(200);lcd.clear();menu=27;}
if (digitalRead(BACK)==LOW){klick();delay(200);lcd.clear();menu=25;}
if (digitalRead(UP)==LOW&&nextVol_2<4){klick();delay(100);nextVol_2++;}
if (digitalRead(DOWN)==LOW&&nextVol_2>1){klick();delay(100);nextVol_2--;}
break; case(27):
//Halaman ketiga submenu Dua berisi proses Volume II tanpa Pembersihan Selang//
nextSubHalaman2_2_2(); menu=25;
break;
}
delay(50); }
void halaman1()
//Tampilan Pemilihan Washing & Cleanser//
{
lcd.setCursor(0,0); lcd.print(">WASHING & CLEANSER"); lcd.setCursor(0,1);
lcd.print(" SET.VOLUME"); lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}
void halaman2()
//Tampilan Pemilihan Setting Volume//
{
lcd.setCursor(0,0);
lcd.print(" WASHING & CLEANSER"); lcd.setCursor(0,1); lcd.print(">SET.VOLUME");
lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}
void halaman3()
//Tampilan Pemilihan Setting Kecepatan//
{
lcd.setCursor(0,0);
lcd.print(" WASHING & CLEANSER"); lcd.setCursor(0,1);
lcd.print(" SET.VOLUME"); lcd.setCursor(0,2); lcd.print(">SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}
void halaman4()
//Tampilan Pemilihan Setting Timer//
{
lcd.setCursor(0,0);
lcd.print(" WASHING & CLEANSER"); lcd.setCursor(0,1);
lcd.print(" SET.VOLUME"); lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(">SET.TIMER"); }
void halaman5()
//Tampilan Pemilihan Start//
{
lcd.setCursor(0,0);
lcd.print(">START"); }
void subHalaman1()
//Tampilan Pemilihan Washing//
{
lcd.setCursor(6,1); lcd.print("WASHING"); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}
void subHalaman1_1() //Tampilan Proses Washing//
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(7,1); lcd.print("PROSES"); lcd.setCursor(7,2);
lcd.print("WASHING"); lcd.setCursor(0,3); lcd.print("------*********-----"); washingPump();
delay(200);
lcd.clear(); }
void subHalaman1_2() //Tampilan Pemilihan Cleanser//
{
lcd.setCursor(5,1); lcd.print("CLEANSER"); lcd.setCursor(13,3); lcd.print("[START]");
}
void subHalaman1_3() //Tampilan Proses Cleanser//
{
lcd.setCursor(0,0); lcd.print("-------******-------");
lcd.setCursor(7,1); lcd.print("PROSES");
lcd.setCursor(6,2); lcd.print("CLEANSER"); lcd.setCursor(0,3); lcd.print("-----**********-----"); cleanserPump();
delay(200);
lcd.clear(); }
void subHalaman2_1()
//Tampilan Pemilihan Setting Volume I//
{
lcd.setCursor(0, 0); lcd.print(">SET.VOLUME I"); lcd.setCursor(0, 1);
lcd.print(" SET.VOLUME II"); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(16,3); lcd.print("[OK]");
}
void subHalaman2_1_1()
//Tampilan Pemilihan jumlah Volume I//
{
lcd.setCursor(4,0);
lcd.print("SET VOLUME I"); lcd.setCursor(11,1);
lcd.print("ml");
lcd.setCursor(7, 1); if(vol_1==1){lcd.print(" 25 ml ");} if(vol_1==2){lcd.print(" 50 ml ");} if(vol_1==3){lcd.print(" 75 ml ");} if(vol_1==4){lcd.print(" 100 ml ");}
lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}
void subHalaman2_1_2()
//Tampilan proses pengisian Volume I//
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(0,3); lcd.print("-------******-------"); lcd.setCursor(2, 1); lcd.print("PROSES PENGISIAN"); lcd.setCursor(10,2); lcd.print("ml");
lcd.setCursor(6, 2); if(vol_1==1){lcd.print(" 25 ml ");} if(vol_1==2){lcd.print(" 50 ml ");} if(vol_1==3){lcd.print(" 75 ml ");} if(vol_1==4){lcd.print(" 100 ml ");} waterPump1();
delay(200);
lcd.clear();
}
void subHalaman2_2()
//Tampilan Pemilihan Setting Volume II//
{
lcd.setCursor(0,0);
lcd.print(" SET.VOLUME I"); lcd.setCursor(0,1); lcd.print(">SET.VOLUME II"); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(16,3); lcd.print("[OK]");
}
void subHalaman2_2_1()
//Tampilan Pemilihan jumlah Volume II//
{
lcd.setCursor(4,0);
lcd.print("SET VOLUME II"); lcd.setCursor(11,1);
lcd.print("ml");
lcd.setCursor(7, 1); if(vol_2==1){lcd.print(" 25 ml ");} if(vol_2==2){lcd.print(" 50 ml ");} if(vol_2==3){lcd.print(" 75 ml ");} if(vol_2==4){lcd.print(" 100 ml ");} lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}
void subHalaman2_2_2()
//Tampilan proses pengisian Volume II//
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(0,3); lcd.print("-------******-------"); lcd.setCursor(2, 1); lcd.print("PROSES PENGISIAN"); lcd.setCursor(10,2); lcd.print("ml");
lcd.setCursor(6, 2); if(vol_2==1){lcd.print(" 25 ml ");} if(vol_2==2){lcd.print(" 50 ml ");} if(vol_2==3){lcd.print(" 75 ml ");} if(vol_2==4){lcd.print(" 100 ml ");} waterPump2();
delay(200);
lcd.clear();
}
void subHalaman3()
//Tampilan Pemilihan Kecepatan//
{
lcd.setCursor(3, 0);
lcd.print("SET KECEPATAN"); lcd.setCursor(11, 1); lcd.print("rpm"); lcd.setCursor(6, 1);
if(kec==1){lcd.print(" 100 rpm ");}
if(kec==2){lcd.print(" 150 rpm ");}
if(kec==3){lcd.print(" 250 rpm ");}
lcd.setCursor(0,3);
lcd.print("[BACK]");
lcd.setCursor(16,3);
lcd.print("[OK]");
}
void subHalaman4() //Tampilan Pemilihan Timer//
{
lcd.setCursor(4, 0); lcd.print("SETTING TIMER"); lcd.setCursor(7, 1); lcd.print(setTimer);
lcd.print(" menit "); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(16,3); lcd.print("[OK]");
}
void subHalaman5()
//Tampilan hasil setting Kecepatan & Timer//
{
lcd.setCursor(0, 0);
lcd.print("Kec. :");
if(kec==1){lcd.print(" 100 rpm ");}
if(kec==2){lcd.print(" 150 rpm ");}
if(kec==3){lcd.print(" 250 rpm ");}
lcd.setCursor(0, 1); lcd.print("Tim. :"); lcd.setCursor(7,1);
if(setTimer < 10) lcd.print("0"); lcd.print(setTimer); lcd.print(":");
if(detik < 10) lcd.print("0"); lcd.print(detik);
lcd.print(" "); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}
void subHalaman5_1()
//Tampilan running Kecepatan & Timer//
{
if(detik<0)
{
detik=59;
setTimer--;
}
lcd.setCursor(0, 1);
lcd.print("Kec. :");
if(kec==1){
lcd.print(" 100 rpm ");
}
if(kec==2){
lcd.print(" 150 rpm ");
}
if(kec==3){
lcd.print(" 250 rpm ");
}
lcd.setCursor(0, 2);
lcd.print("Tim. :");
lcd.setCursor(7,2);
if(setTimer < 10) lcd.print("0"); lcd.print(setTimer); lcd.print(":");
if(detik < 10) lcd.print("0"); lcd.print(detik); lcd.print(" "); //lcd.print(setpoints1); //menampilkan nilai pwm
lcd.print(" "); lcd.setCursor(0,0); lcd.print("--------------------"); lcd.setCursor(0,3); lcd.print("--------------------");
startMotor();
}
void subHalaman5_2()
//Tampilan running selesai Kecepatan & Timer//
{
stopMotor();
MsTimer2::stop();
lcd.setCursor(0,0);
lcd.print("-------******-------");
lcd.setCursor(7,1);
lcd.print("PROSES");
lcd.setCursor(7,2);
lcd.print("SELESAI");
lcd.setCursor(0,3);
lcd.print("-----**********-----");
digitalWrite(buzzer, LOW);
delay(2000);
digitalWrite(buzzer, HIGH);
lcd.clear(); }
void nextHalaman1()
//Tampilan Pemilihan Washing & Cleanser tanpa Pembersihan Selang//
{
lcd.setCursor(0,0); lcd.print(">WASHING & CLEANSER"); lcd.setCursor(0,1);
lcd.print(" SET.VOLUME"); lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}
void nextHalaman2()
//Tampilan Pemilihan Setting Volume tanpa Pembersihan Selang//
{
lcd.setCursor(0,0);
lcd.print(" WASHING & CLEANSER"); lcd.setCursor(0,1); lcd.print(">SET.VOLUME"); lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}
void nextSubHalaman2_1()
//Tampilan Pemilihan Setting Volume I tanpa Pembersihan Selang//
{
lcd.setCursor(0, 0); lcd.print(">SET.VOLUME I"); lcd.setCursor(0, 1);
lcd.print(" SET.VOLUME II"); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(16,3); lcd.print("[OK]");
}
void nextSubHalaman2_1_1()
//Tampilan Pemilihan jumlah Volume I tanpa Pembersihan Selang//
{
lcd.setCursor(4,0);
lcd.print("SET VOLUME I"); lcd.setCursor(11,1);
lcd.print("ml");
lcd.setCursor(7, 1); if(nextVol_1==1){lcd.print(" 25 ml ");} if(nextVol_1==2){lcd.print(" 50 ml ");} if(nextVol_1==3){lcd.print(" 75 ml ");} if(nextVol_1==4){lcd.print(" 100 ml ");} lcd.setCursor(0,3);
lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}
void nextSubHalaman2_1_2()
//Tampilan proses pengisian Volume I tanpa Pembersihan Selang//
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(0,3); lcd.print("-------******-------"); lcd.setCursor(2, 1); lcd.print("PROSES PENGISIAN"); lcd.setCursor(10,2); lcd.print("ml");
lcd.setCursor(6, 2); if(nextVol_1==1){lcd.print(" 25 ml ");} if(nextVol_1==2){lcd.print(" 50 ml ");} if(nextVol_1==3){lcd.print(" 75 ml ");} if(nextVol_1==4){lcd.print(" 100 ml ");} NextWaterPump1();
delay(200);
lcd.clear();
}
void nextSubHalaman2_2 ()
//Tampilan Pemilihan Setting Volume II tanpa Pembersihan Selang//
{
lcd.setCursor(0,0);
lcd.print(" SET.VOLUME I"); lcd.setCursor(0,1); lcd.print(">SET.VOLUME II"); lcd.setCursor(0,3); lcd.print("[BACK]");
lcd.setCursor(16,3);
lcd.print("[OK]"); }
void nextSubHalaman2_2_1 ()
//Tampilan Pemilihan jumlah Volume II tanpa Pembersihan Selang//
{
lcd.setCursor(4,0);
lcd.print("SET VOLUME II"); lcd.setCursor(11,1);
lcd.print("ml");
lcd.setCursor(7, 1); if(nextVol_2==1){lcd.print(" 25 ml ");} if(nextVol_2==2){lcd.print(" 50 ml ");} if(nextVol_2==3){lcd.print(" 75 ml ");} if(nextVol_2==4){lcd.print(" 100 ml ");} lcd.setCursor(0,3);
lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}
void nextSubHalaman2_2_2 ()
//Tampilan proses pengisian Volume II tanpa Pembersihan Selang//
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(0,3); lcd.print("-------******-------");
lcd.setCursor(2, 1);
lcd.print("PROSES PENGISIAN"); lcd.setCursor(10,2);
lcd.print("ml");
lcd.setCursor(6, 2); if(nextVol_2==1){lcd.print(" 25 ml ");} if(nextVol_2==2){lcd.print(" 50 ml ");} if(nextVol_2==3){lcd.print(" 75 ml ");} if(nextVol_2==4){lcd.print(" 100 ml ");} NextWaterPump2();
delay(200);
lcd.clear();
}
void nama()
{
lcd.clear();
lcd.begin();
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("ORBITAL SHAKER");
delay(2000);
lcd.clear();
}
void klick()
{
digitalWrite(buzzer, LOW); delay(200); digitalWrite(buzzer, HIGH);
}
//pengaturan kondisi Buzzer saat tombol ditekan
void washingPump() // dengan air
{ startWaterPump(); delay(5200);
//pengaturan pembersihan selang I dan selang
stopWaterPump(); }
void cleanserPump() // tanpa air
{ startWaterPump();
delay(8000);
stopWaterPump();
}
void waterPump1()
{
//pengaturan pengosongan selang cairan I dan
//pengaturan volume cairan I
if(vol_1==1){startWaterPump1();delay(2200);stopWaterPump();} if(vol_1==2){startWaterPump1();delay(3200);stopWaterPump();} if(vol_1==3){startWaterPump1();delay(4200);stopWaterPump();} if(vol_1==4){startWaterPump1();delay(5200);stopWaterPump();}
}
void waterPump2() //pengaturan volume cairan II
{
if(vol_2==1){startWaterPump2();delay(2200);stopWaterPump();} if(vol_2==2){startWaterPump2();delay(3200);stopWaterPump();} if(vol_2==3){startWaterPump2();delay(4200);stopWaterPump();} if(vol_2==4){startWaterPump2();delay(5200);stopWaterPump();}
}
void NextWaterPump1() //pengaturan volume cairan I tanpa pembersihan selang
{
if(nextVol_1==1){startWaterPump1();delay(1000);stopWaterPump();} if(nextVol_1==2){startWaterPump1();delay(2000);stopWaterPump();} if(nextVol_1==3){startWaterPump1();delay(3000);stopWaterPump();} if(nextVol_1==4){startWaterPump1();delay(4000);stopWaterPump();}
}
void NextWaterPump2() //pengaturan volume cairan II tanpa pembersihan selang
{ if(nextVol_2==1){startWaterPump2();delay(1000);stopWaterPump();} if(nextVol_2==2){startWaterPump2();delay(2000);stopWaterPump();} if(nextVol_2==3){startWaterPump2();delay(3000);stopWaterPump();} if(nextVol_2==4){startWaterPump2();delay(4000);stopWaterPump();}
}
void startWaterPump() //secara bersamaan
{
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); }
void startWaterPump1() {
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); }
//pengaturan mulai water pump 1 dan water pump 2
//pengaturan mulai water pump 1
void startWaterPump2() {
digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); }
void stopWaterPump() {
digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW);
}
void startMotor() {
//pengaturan kecepatan motor dc
digitalWrite(R_motor, HIGH);
digitalWrite(L_motor, LOW);
if(kec==1){
if(setpoints1 < 127.5){
setpoints1 = setpoints1 + 5.0;
}
if(setpoints1 >= 127.5){
setpoints1 = 127.5;
}
analogWrite(motor, setpoints1); //nilai PWM untuk kecepatan 100 RPM
}
if(kec==2){
if(setpoints2 < 191.25){
setpoints2 = setpoints2 + 5.0;
}
if(setpoints2 >= 191.25){
setpoints2 = 191.25;
}
analogWrite(motor, setpoints2); //nilai PWM untuk kecepatan 150 RPM
}
if(kec==3){
if(setpoints3 < 231.25){
setpoints3 = setpoints3 + 5.0;
}
if(setpoints3 >= 231.25){
setpoints3 = 231.25;
}
analogWrite(motor, setpoints3); //nilai PWM untuk kecepatan 250 RPM
}
}
void stopMotor() //pengaturan berhenti kerja motor dc
{
if(kec==1){
if(setpoints1 > 0){
setpoints1 = setpoints1 - 1.0;
digitalWrite(R_motor, HIGH);
digitalWrite(L_motor, LOW);
analogWrite(motor, setpoints1);
}
if(setpoints1 <= 0){
setpoints1 = 0;
digitalWrite(R_motor, LOW);
digitalWrite(L_motor, LOW);
analogWrite(motor, setpoints1); //nilai PWM untuk kecepatan 100 RPM
return;
}
}
if(kec==2){
if(setpoints2 > 0){
setpoints2 = setpoints2 - 1.0;
digitalWrite(R_motor, HIGH);
digitalWrite(L_motor, LOW);
analogWrite(motor, setpoints2);
}
if(setpoints2 <= 0){
setpoints2 = 0;
digitalWrite(R_motor, LOW);
digitalWrite(L_motor, LOW);
analogWrite(motor, setpoints2); //nilai PWM untuk kecepatan 100 RPM
return;
}
}
if(kec==3){
if(setpoints3 > 0){
setpoints3 = setpoints3 - 1.0;
digitalWrite(R_motor, HIGH);
digitalWrite(L_motor, LOW);
analogWrite(motor, setpoints3);
}
if(setpoints3 <= 0){
setpoints3 = 0;
digitalWrite(R_motor, LOW);
digitalWrite(L_motor, LOW);
analogWrite(motor, setpoints3); //nilai PWM untuk kecepatan 100 RPM
return;
}
}
stopMotor();
}