Translate

Timer Lomba Wireless RF Link 433 Mhz Interface DMD P10

Timer Lomba Wireless RF Link 433 Mhz Interface DMD P10


        Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara untuk membuat sebuah timer lomba dengan start stop jarak jauh menggunakan modul RF Link 433 Mhz. alat ini menggunakan interface modul dmd p10 dengan sensor jarak sebagai sensornya. untuk lebih jelasnya berikut adalah koding skemanya.


1. Skema


2. Program Transmitter

// RF 433MHz Modules (Transmitter Circuit)

#include <RH_ASK.h>
// Serial Peripheral Interface (SPI)
#include <SPI.h>               // Needed to compile

RH_ASK driver;


// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 11;

// the setup routine runs once when you press reset:
void setup() {
  Serial.begin (9600);         // Debugging ONLY
  if (!driver.init ())
    Serial.println ("init failed");
  pinMode(pushButton, INPUT_PULLUP);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  int buttonState = digitalRead(pushButton);

    if(buttonState == 0){
    const char *msg = "111";
    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    }

    if(buttonState == 1){
    const char *msg = "222";
    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    }
    
    delay(100);
}


3. Program Receiver RF LINK

#include "Wire.h"
#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile

RH_ASK driver;

int relay = 8;

String a;

void setup() {
  Serial.begin(9600);
  pinMode(relay, OUTPUT);

 if (!driver.init())
         Serial.println("init failed");
 
}

void loop() {

 uint8_t buf[12];
    uint8_t buflen = sizeof(buf);
    if (driver.recv(buf, &buflen)) // Non-blocking
    {
      int i;
      // Message with a good checksum received, dump it.
     int nilai = atoi((char*)buf);
     Serial.println(nilai);

     if(nilai == 111){
      digitalWrite(relay,HIGH);
      }

     if(nilai == 222){
      digitalWrite(relay,LOW);
      }
         
    }

  delay(100);


}



4. Program Receiver DMD P10

#include <Wire.h>
#include <SPI.h>        //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h>        //Library DMD yang menyediakan fungsi penampilan teks, gambar dsb
#include <TimerOne.h>   //Library peripheral Timer1 untuk menjalankan prosedur pindai panel DMD
#include <Time.h>     //Library waktu yang menyediakan tipe data, struktur, dan obyek waktu
#include "Arial_black_16.h"
#include "Arial_Black_16_ISO_8859_1.h"
#include "Arial14.h"
#include "DejaVuSans9.h"
#include "Droid_Sans_12.h"
#include "Droid_Sans_16.h"
#include "DejaVuSansItalic9.h"
#include "Mono5x7.h"
#include "SystemFont5x7.h"

#define DISPLAY_COLUMN_COUNT  2
#define DISPLAY_ROW_COUNT     1

#define PIXELS_PER_COLUMN  32
#define PIXELS_PER_ROW    16

DMD dmd(DISPLAY_COLUMN_COUNT, DISPLAY_ROW_COUNT);
unsigned char show = 0;

char lineBuff[20];
int tombol = 2;
int tombolx;
int lineA;
int lineB;
int lineC;
int mulai;
int seconds;
int cs;
int secondsa;
int csa;
int secondsb;
int csb;
int secondsc;
int csc;
int kecepatan;
int jarak = 5;
long start_time = 0;
int lapa,lapb,lapc;
int finisha = 0;

void ScanDMD()
{
  dmd.scanDisplayBySPI();
}

void setup(void)
{  
pinMode(5,INPUT_PULLUP);
pinMode(tombol,INPUT_PULLUP);

  dmd.clearScreen( true );   //true is normal (all pixels off), false is negative (all pixels on)
  Serial.begin(9600);
   //initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
  Timer1.initialize( 1000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
  Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()
  //clear/init the DMD pixels held in RAM
  dmd.clearScreen( true );
}

void loop(void)
{

//============================================
lineA = digitalRead(5);
Serial.println(lineA);
if(lineA == 1){
secondsa = seconds;
csa = cs;
finisha = 1;
dmd.clearScreen( true );
hasil();
dmd.clearScreen( true );
hasil2();
}

//=============================================
tombolx = digitalRead(tombol);

if((tombolx == 1)&&(mulai == 0)){
  delay(200);
  mulai = 1;
  start_time = millis();  
}  

if(mulai == 1){
seconds = (millis() - start_time) / 1000;
cs = ((millis() - start_time) / 10) % 100;;
}

//===========================================================================  
sprintf(lineBuff, "%d:%d ", seconds, cs);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 35,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  
//===========================================================================

delay(1);
}

void hasil(){

sprintf(lineBuff, "%d:%d  ", secondsa, csa);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 35,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  
delay(5000);
}


void hasil2(){
kecepatan = jarak / secondsa;
sprintf(lineBuff, "%d  ", kecepatan);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 35,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  

hasil2();
}



5. VIDEO HASILNYA





Stirer Kendali Jarak Jauh Online Blynk 2.0



        Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yaitu Stirer Kendali Jarak Jauh Online Blynk yang mana fungsinya yaitu untuk mencampurkan cairan dan juga mengaduk secara otomatis dengan timer. alat ini diinput menggunakan aplikasi Blynk 2.0 secara online jarak jauh sehingga memuahkan penggunaan. untuk lebih jelasnya berikut adalah koding dan skemanya.  


1. Komponen



2. Program Arduino Uno

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <DS3231.h>

LiquidCrystal_I2C lcd(0x27,20,4);

DS3231  rtc(SDA, SCL);

// Init a Time-data structure
Time  t;

#define ONE_WIRE_BUS 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void(* resetFunc) (void) = 0;

int temp;
int x = 5;
int y;
int tanda;

float TempC;
int ssr = 7;
int motor1 = 5;
int motor2 = 6;

int waktu;
int value1;
int value2;
int value3;
int value4;
int value5;
int value6;
int value7;

int pompa1 = 2;
int pompa2 = 3;
int pompa3 = 9;
int pompa4 = 10;
int pompa;
int motor;
int suhu;
int jam;
int menit;
int detik;
int tombol;
int sampling;

int datain1;
int datain2;
int datain3;
int datain4;
int datain5;
int datain6;
int datain7;
int datain8;

String dataIn;
String dt[10];
int i;
boolean parsing = false;

void setup()
{
 
  dataIn="";
  Serial.begin(9600);
  lcd.begin();
  lcd.clear();
  lcd.noCursor();
  delay(10);
  
  Wire.begin();
  sensors.begin();
  rtc.begin();
  pinMode(ssr,OUTPUT);
  pinMode(pompa1,OUTPUT);
  pinMode(pompa2,OUTPUT); 
  pinMode(pompa3,OUTPUT);
  pinMode(pompa4,OUTPUT);   
  pinMode(motor1,OUTPUT);
  pinMode(motor2,OUTPUT); 
  digitalWrite(motor1,LOW);
  digitalWrite(motor2,LOW); 
  // The following lines can be uncommented to set the date and time
  //rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY
  rtc.setTime(0, 0, 0);     // Set the time to 12:00:00 (24hr format)
  //rtc.setDate(1, 1, 2014); 

}

void loop()
{

while(Serial.available()>0) {
//   dataIn="";
    char inChar = (char)Serial.read();
    dataIn += inChar;
    if (inChar == '\n') {
    parsing = true;
  }
}

if(parsing){
       
  lcd.setCursor(0,0);
  lcd.print("pompa:");
  lcd.print(pompa);
  lcd.print(" ml/s  ");
  lcd.setCursor(0,1);
  lcd.print("motor:");
  lcd.print(motor);
  lcd.print(" rpm   ");
  lcd.setCursor(0,2);
  lcd.print("suhu:");
  lcd.print(suhu);
  lcd.print(" c  ");
  lcd.setCursor(0,3);
  lcd.print("waktu:");
  lcd.print(jam);
  lcd.print(":");
  lcd.print(menit);
  lcd.print(":");
  lcd.print(detik);
  lcd.print("   ");
  lcd.setCursor(18,0);
  lcd.print(sampling);
  lcd.print(" ");

 delay(1000);

if(tombol == 1){
  datain7 = 0;
  delay(1000);
  lcd.clear();
  setsuhu();
  rtc.setTime(0, 0, 0);
  mulai();
  selesai();
}
 
parsingData();
  
 }
}

void parsingData(){
int j=0;

//kirim data yang telah diterima sebelumnya
//Serial.print("data masuk : ");
//Serial.print(dataIn);
//Serial.print("\n");

//inisialisasi variabel, (reset isi variabel)
dt[j]="";
//proses parsing data
for(i=1;i<dataIn.length();i++){
//pengecekan tiap karakter dengan karakter (#) dan (,)
if ((dataIn[i] == '#') || (dataIn[i] == ','))
{
//increment variabel j, digunakan untuk merubah index array penampung
j++;
dt[j]="";       //inisialisasi variabel array dt[j]
}
else
{
//proses tampung data saat pengecekan karakter selesai.
dt[j] = dt[j] + dataIn[i];
}
}

 datain1 = dt[0].toInt();
 datain2 = dt[1].toInt();
 datain3 = dt[2].toInt();
 datain4 = dt[3].toInt();
 datain5 = dt[4].toInt();
 datain6 = dt[5].toInt();
 datain7 = dt[6].toInt();
 datain8 = dt[7].toInt();
 
 pompa = datain1 / 1;
 motor = datain2 / 1;
 suhu = datain3 / 1;
 jam = datain4 / 1;
 menit = datain5 / 1;
 detik = datain6 / 1;
 sampling = datain7 / 1;
 tombol = datain8 / 1;
 
}

void mulai(){

analogWrite(motor1,motor);
analogWrite(motor2,motor);
  
t = rtc.getTime();
sensors.requestTemperatures();
TempC = sensors.getTempCByIndex(0); // Celcius

  lcd.setCursor(0,0);
  lcd.print("pompa:");
  lcd.print(pompa);
  lcd.print(" ml/s  ");
  lcd.setCursor(0,1);
  lcd.print("motor:");
  lcd.print(motor);
  lcd.print(" Rpm   ");
  lcd.setCursor(0,2);
  lcd.print("suhu:");
  lcd.print(TempC);
  lcd.print(" / ");
  lcd.print(suhu);
  lcd.print(" c  ");
  lcd.setCursor(0,3);
  lcd.print("waktu:");
  lcd.print(t.hour, DEC);
  lcd.print(":");
  lcd.print(t.min, DEC);
  lcd.print(":");
  lcd.print(t.sec, DEC);
  lcd.print("   ");

if((t.hour == jam)&&(t.min == menit)&&(t.sec == detik)){
lcd.clear();
delay(3000);
return;  
}

if(t.sec == 59){ 
waktu++;
delay(1000);  
}

if(waktu == sampling){ 
digitalWrite(pompa1,HIGH);
digitalWrite(pompa2,HIGH); 
delay(pompa); 
digitalWrite(pompa1,LOW);
digitalWrite(pompa2,LOW); 
delay(pompa);  
digitalWrite(pompa3,HIGH);
digitalWrite(pompa4,HIGH); 
delay(pompa); 
digitalWrite(pompa3,LOW);
digitalWrite(pompa4,LOW);
delay(1000);   
waktu = 0;  
}
  
if(TempC >= suhu){
  digitalWrite(ssr,LOW);
}

if(TempC < suhu){
  digitalWrite(ssr,HIGH);
}

mulai();  
}

void selesai(){
lcd.setCursor(0,0);
lcd.print("selesai");  
datain7 = 0;
tanda = 0;
digitalWrite(motor1,LOW);
digitalWrite(motor2,LOW);
delay(5000);
resetFunc();
}

void setsuhu(){
sensors.requestTemperatures();
TempC = sensors.getTempCByIndex(0); // Celcius
  
  lcd.setCursor(0,0);
  lcd.print("suhu:");
  lcd.print(TempC);
  lcd.print(" / ");
  lcd.print(suhu);
  lcd.print(" c  ");

digitalWrite(ssr,HIGH);

if(TempC >= suhu){
  delay(1000);
  lcd.clear();
  return;  
}

setsuhu();  
}



3. Program ESP8266

#define BLYNK_TEMPLATE_ID "RTYHVHKFCDhjk"
#define BLYNK_TEMPLATE_NAME "stirer projek"
#define BLYNK_AUTH_TOKEN "HGGVHGCHFGDKJHKJGJVGCGcfhgvghchgh"

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char ssid[] = "hotspothpku";       
char pass[] = "123456789";

int pompa;
int motor;
int suhu;
int jam;
int menit;
int detik;
int tombol;
int sampling;
int x = 0;

// function to assign value to variable Slider_Value
BLYNK_WRITE(V0)   
{
  pompa = param.asInt(); // assigning incoming value from pin V0 to a variable 
}

BLYNK_WRITE(V1)
{
  motor = param.asInt(); // assigning incoming value from pin V0 to a variable
}

BLYNK_WRITE(V2)
{
  suhu = param.asInt(); // assigning incoming value from pin V0 to a variable 
}

BLYNK_WRITE(V3)
{
  jam = param.asInt(); // assigning incoming value from pin V0 to a variable 
}

BLYNK_WRITE(V4)
{
  menit = param.asInt(); // assigning incoming value from pin V0 to a variable 
}

BLYNK_WRITE(V5)
{
  detik = param.asInt(); // assigning incoming value from pin V0 to a variable 
}

BLYNK_WRITE(V6)
{
  sampling = param.asInt(); // assigning incoming value from pin V0 to a variable 
}

BLYNK_WRITE(V7)
{
  tombol = param.asInt(); // assigning incoming value from pin V0 to a variable 
}

void setup()
{   
  Serial.begin(9600);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}

void loop()
{             
  Serial.print("*");
  Serial.print(pompa);
  Serial.print(",");
  Serial.print(motor);
  Serial.print(",");
  Serial.print(suhu);
  Serial.print(",");
  Serial.print(jam);
  Serial.print(",");
  Serial.print(menit);
  Serial.print(",");
  Serial.print(detik);
  Serial.print(",");
  Serial.print(sampling);
  Serial.print(",");
  Serial.print(tombol);
  Serial.println("#");   
  
  Blynk.run();

delay(200);  
}



4. VIDEO HASILNYA



Alat Kendali Dimmer dan Timer Interface LCD TFT

Alat Kendali Dimmer dan Timer Interface LCD TFT



       Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang menggunakan dimmer modul dan timer sebagi fitur utamanya. interface menggunakan LCD TFT dan terdapat pula fitur EEprom sehingga data tidak hilang ketika di simpan. untuk lebih jelasnya berikut adalah koding dan komponennya.


1. Modul Dimmer



2. Program Arduino IDE

#include "SPI.h"
#include <Adafruit_GFX.h>
#include <ILI9488.h>
#include <max6675.h>   
#include <RBDdimmer.h>
#include <EEPROM.h>

#define TFT_CS         10
#define TFT_DC         8
//#define TFT_LED      5v
#define TFT_RST        9
#define TFT_MOSI       11
#define TFT_CLK        13
#define TFT_MISO       12

ILI9488 tft = ILI9488(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

int addr1 = 0;
int addr2 = 1;
int addr3 = 2;
int addr4 = 3;
int addr5 = 4;

int timerinfusion;
int ssr1 = 30;
int ssr2 = 31;

#define outputPin  7 
#define zerocross  2 // for boards with CHANGEBLE input pins

dimmerLamp dimmer(outputPin); //initialase port for dimmer for MEGA, Leonardo, UNO, Arduino M0, Arduino Zero

int waktu = 10;

int thermoDO1 = 16; //bisa juga S0
int thermoCS1 = 15;
int thermoCLK1 = 14; //bisa juga SCK
MAX6675 thermocouple1(thermoCLK1, thermoCS1, thermoDO1);

int thermoDO2 = 19; //bisa juga S0
int thermoCS2 = 18;
int thermoCLK2 = 17; //bisa juga SCK
MAX6675 thermocouple2(thermoCLK2, thermoCS2, thermoDO2);

int thermoDO3 = 22; //bisa juga S0
int thermoCS3 = 21;
int thermoCLK3 = 20; //bisa juga SCK
MAX6675 thermocouple3(thermoCLK3, thermoCS3, thermoDO3);

int x1 = 0;
int y1 = 150;
int x2 = 500;
int y2 = 150;
int suhu1, suhu2, suhu3;

int btset = A0;
int btup = A1;
int btdown = A2;
int btok = A3;

int bton1 = A4;
int btoff1 = A5;
int bton2 = A6;
int btoff2 = A7;

int btsetx;
int btupx;
int btdownx;
int btokx;

int bton1x;
int btoff1x;
int bton2x;
int btoff2x;

int cacah;

int timepreheat1;
int pwm1;
int pwm2;
int sp1;
int sp2;
int convpwm;

unsigned long start;

  
void setup() {

timepreheat1 = EEPROM.read(addr1);
pwm1 = EEPROM.read(addr2);
pwm2 = EEPROM.read(addr3);
sp1 = EEPROM.read(addr4);
sp2 = EEPROM.read(addr5);
  
  Serial.begin(9600);
  pinMode(6,OUTPUT); 
  pinMode(7,OUTPUT); 
  pinMode(ssr1,OUTPUT);
  pinMode(ssr2,OUTPUT);
  pinMode(btset,INPUT_PULLUP);
  pinMode(btup,INPUT_PULLUP);
  pinMode(btdown,INPUT_PULLUP);
  pinMode(btok,INPUT_PULLUP);

  pinMode(bton1,INPUT_PULLUP);
  pinMode(btoff1,INPUT_PULLUP);
  pinMode(bton2,INPUT_PULLUP);
  pinMode(btoff2,INPUT_PULLUP);
  
  tft.begin();
  tft.fillScreen(ILI9488_BLACK);
  tft.setRotation(1);
  tft.setTextSize(2);
  
delay(500);
}


void loop() {

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

bton1x = digitalRead(bton1);
btoff1x = digitalRead(btoff1);
bton2x = digitalRead(bton2);
btoff2x = digitalRead(btoff2);

if(bton1x == 0){
  delay(1);
  tft.fillScreen(ILI9488_BLACK);
  mulai1();
}

if(bton2x == 0){
  delay(1);
  tft.fillScreen(ILI9488_BLACK);
  mulai2();
}

if(btsetx == 0){
  delay(1);
  cacah++;
}

if(btokx == 0){
  delay(1);
  cacah--;
}

if(cacah > 4){
  cacah = 0;
}

if(cacah < 0){
  cacah = 0;
}
 
  suhu1 = thermocouple1.readCelsius();
  suhu2 = thermocouple2.readCelsius();
  suhu3 = thermocouple3.readCelsius();
  
  tft.setCursor(5, 10);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu1: ");  
  tft.print(suhu1);  
  tft.print(" C ");  

  tft.setCursor(5, 40);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu2: ");
  tft.print(suhu2);    
  tft.print(" C ");  

  tft.setCursor(5, 70);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu3: ");
  tft.print(suhu3);    
  tft.print(" C ");  

  if(cacah == 0){
  EEPROM.write(addr1, timepreheat1);
  timerinfusion = timepreheat1;
  if(btupx == 0){
    delay(1);
    timepreheat1 = timepreheat1 + 1; 
  }

  if(btdownx == 0){
    delay(1);
    timepreheat1 = timepreheat1 - 1; 
  }
      
  tft.setCursor(5, 120);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("-> Time Pre Infusion: ");
  tft.print(timepreheat1);    
  tft.print("     "); 
 
  tft.setCursor(5, 150);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 1: ");
  tft.print(pwm1);    
  tft.print("      "); 

  tft.setCursor(5, 180);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 2: ");
  tft.print(pwm2);    
  tft.print("      ");

  tft.setCursor(5, 210);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU1: ");
  tft.print(sp1);    
  tft.print("      "); 

  tft.setCursor(5, 240);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU2: ");
  tft.print(sp2);    
  tft.print("      ");
  
  }


  if(cacah == 1){
  EEPROM.write(addr2, pwm1);
  if(btupx == 0){
    delay(1);
    pwm1 = pwm1 + 1; 
  }

  if(btdownx == 0){
    delay(1);
    pwm1 = pwm1 - 1;; 
  }
      
  tft.setCursor(5, 120);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("Time Pre Infusion: ");
  tft.print(timepreheat1);    
  tft.print("     "); 
 
  tft.setCursor(5, 150);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("-> PWM 1: ");
  tft.print(pwm1);    
  tft.print("      "); 

  tft.setCursor(5, 180);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 2: ");
  tft.print(pwm2);    
  tft.print("      ");

  tft.setCursor(5, 210);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU1: ");
  tft.print(sp1);    
  tft.print("      "); 

  tft.setCursor(5, 240);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU2: ");
  tft.print(sp2);    
  tft.print("      ");
  }


  if(cacah == 2){
  EEPROM.write(addr3, pwm2);
  if(btupx == 0){
    delay(1);
    pwm2 = pwm2 + 1;  
  }

  if(btdownx == 0){
    delay(1);
    pwm2 = pwm2 - 1;  
  }
      
  tft.setCursor(5, 120);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("Time Pre Infusion: ");
  tft.print(timepreheat1);    
  tft.print("     "); 
 
  tft.setCursor(5, 150);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 1: ");
  tft.print(pwm1);    
  tft.print("      "); 

  tft.setCursor(5, 180);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("-> PWM 2: ");
  tft.print(pwm2);    
  tft.print("      ");

  tft.setCursor(5, 210);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU1: ");
  tft.print(sp1);    
  tft.print("      "); 

  tft.setCursor(5, 240);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU2: ");
  tft.print(sp2);    
  tft.print("      ");
  }

  if(cacah == 3){
  EEPROM.write(addr4, sp1);
  if(btupx == 0){
    delay(1);
    sp1 = sp1 + 1;  
  }

  if(btdownx == 0){
    delay(1);
    sp1 = sp1 - 1;  
  }

      
  tft.setCursor(5, 120);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("Time Pre Infusion: ");
  tft.print(timepreheat1);    
  tft.print("     "); 
 
  tft.setCursor(5, 150);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 1: ");
  tft.print(pwm1);    
  tft.print("      "); 

  tft.setCursor(5, 180);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 2: ");
  tft.print(pwm2);    
  tft.print("      ");

  tft.setCursor(5, 210);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("-> SP SUHU1: ");
  tft.print(sp1);    
  tft.print("      "); 

  tft.setCursor(5, 240);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU2: ");
  tft.print(sp2);    
  tft.print("      ");
  }


  if(cacah == 4){
  EEPROM.write(addr5, sp2);
  if(btupx == 0){
    delay(1);
    sp2 = sp2 + 1;  
  }

  if(btdownx == 0){
    delay(1);
    sp2 = sp2 - 1;  
  }
      
  tft.setCursor(5, 120);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("Time Pre Infusion: ");
  tft.print(timepreheat1);    
  tft.print("     "); 
 
  tft.setCursor(5, 150);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 1: ");
  tft.print(pwm1);    
  tft.print("      "); 

  tft.setCursor(5, 180);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 2: ");
  tft.print(pwm2);    
  tft.print("      ");

  tft.setCursor(5, 210);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU1: ");
  tft.print(sp1);    
  tft.print("      "); 

  tft.setCursor(5, 240);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("-> SP SUHU2: ");
  tft.print(sp2);    
  tft.print("      ");
  } 

delay(1);
 
}

void mulai1(){
dimmer.begin(NORMAL_MODE, ON); 

  suhu1 = thermocouple1.readCelsius();
  suhu2 = thermocouple2.readCelsius();
  suhu3 = thermocouple3.readCelsius();
  
  tft.setCursor(5, 10);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu1: ");  
  tft.print(suhu1);  
  tft.print(" C ");  

  tft.setCursor(5, 40);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu2: ");
  tft.print(suhu2);    
  tft.print(" C ");  

  tft.setCursor(5, 70);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu3: ");
  tft.print(suhu3);    
  tft.print(" C "); 

  tft.setCursor(5, 120);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("Time Pre Infusiom: ");
  tft.print(timerinfusion);    
  tft.print("     ");   
 
  tft.setCursor(5, 150);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 1: ");
  tft.print(pwm1);    
  tft.print("      ");

  tft.setCursor(5, 180);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU1: ");
  tft.print(sp1);    
  tft.print("      ");

  timerinfusion--;
  if(timerinfusion > 0){
  dimmer.setPower(20);
  }
  
  if(timerinfusion <= 0){
    timerinfusion = 0;
    dimmer.setPower(pwm1);
  }

  if(suhu1 > sp1){
    digitalWrite(ssr1,HIGH);
  }

  if(suhu1 < sp1){
    digitalWrite(ssr1,LOW);
  }  

delay(1000);
mulai1();  
}

void mulai2(){

bton1x = digitalRead(bton1);
btoff1x = digitalRead(btoff1);
bton2x = digitalRead(bton2);
btoff2x = digitalRead(btoff2);

if(btoff2x == 0){
  delay(1);
  analogWrite(6, 0);
  tft.fillScreen(ILI9488_BLACK);
  return;
}
  
convpwm = pwm2 * 2.55;

  suhu1 = thermocouple1.readCelsius();
  suhu2 = thermocouple2.readCelsius();
  suhu3 = thermocouple3.readCelsius();
  
  tft.setCursor(5, 10);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu1: ");  
  tft.print(suhu1);  
  tft.print(" C ");  

  tft.setCursor(5, 40);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu2: ");
  tft.print(suhu2);    
  tft.print(" C ");  

  tft.setCursor(5, 70);
  tft.setTextColor(ILI9488_YELLOW,ILI9488_BLACK);  
  tft.print("Suhu3: ");
  tft.print(suhu3);    
  tft.print(" C ");  
 
  tft.setCursor(5, 120);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("Time Pre Infusiom: ");
  tft.print(waktu);    
  tft.print("     "); 

  tft.setCursor(5, 150);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("PWM 2: ");
  tft.print(pwm2);    
  tft.print("      "); 

  tft.setCursor(5, 180);
  tft.setTextColor(ILI9488_GREEN,ILI9488_BLACK);  
  tft.print("SP SUHU2: ");
  tft.print(sp2);    
  tft.print("      "); 

  if(waktu > 0){
  waktu--;
  analogWrite(6,50);
  }
  
  if(waktu <= 0){
    waktu = 0;
    analogWrite(6, convpwm);
  }

  if(suhu2 > sp2){
    digitalWrite(ssr2,HIGH);
  }

  if(suhu2 < sp2){
    digitalWrite(ssr2,LOW);
  }

delay(1000);
mulai2();  
}
 
 
3. VIDEO HASILNYA